Quantcast
Channel: How to replace Mac OS X utilities with GNU core utilities? - Ask Different
Viewing all articles
Browse latest Browse all 8

Answer by Clay Freeman for How to replace Mac OS X utilities with GNU core utilities?

$
0
0

I've written a script to do exactly this! The script can be viewed here (or below). However, I can't always guarantee this post will reflect the latest version of the script linked previously.

Upon running the script, Homebrew will be installed (if not already), all the associated GNU utilities will be installed (if not already), and the PATH variable will be built from the installed utilities.

#!/bin/bash# Install Homebrew (if not already installed)/bin/bash -c "$(curl -fsSL "\"https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"# Install required packages from Homebrewbrew tap homebrew/dupesbrew install coreutils binutils diffutils ed findutils gawk gnu-indent gnu-sed \  gnu-tar gnu-which gnutls grep gzip screen watch wdiff wget bash gdb gpatch \  m4 make nano file-formula git less openssh python rsync svn unzip vim \  --default-names --with-default-names --with-gettext --override-system-vi \  --override-system-vim --custom-system-icons# Empty the .bash_path file that holds GNU paths[[ -f ~/.bash_path ]] && mv ~/.bash_path ~/.bash_path.orig# Build PATH variable script in ~/.bash_pathfor i in /usr/local/Cellar/*/*/bin; do  echo 'export PATH="'$i':$PATH"'>> ~/.bash_pathdonefor i in /usr/local/Cellar/*/*/libexec/gnubin; do  echo 'export PATH="'$i':$PATH"'>> ~/.bash_pathdonefor i in /usr/local/Cellar/*/*/share/man; do  echo 'export MANPATH="'$i':$MANPATH"'>> ~/.bash_pathdonefor i in /usr/local/Cellar/*/*/libexec/gnuman; do  echo 'export MANPATH="'$i':$MANPATH"'>> ~/.bash_pathdone# Check if .bash_path is being called from .bash_profilePATCH=`grep "~/.bash_path" ~/.bash_profile`if [ "$PATCH" == "" ]; then  # Add Ubuntu-style PS1 to .bash_profile  cat <<EOF > ~/.bash_profileexport PS1="\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]# "EOF  # Add .bash_path to .bash_profile  echo "source ~/.bash_path" >> ~/.bash_profilefi

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>