-
-
Save chaosbunker/c31dbc63744c142ff42e to your computer and use it in GitHub Desktop.
GNU-ize Mac OS X El Capitan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install homebrew | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master$ | |
brew doctor | |
# Install required packages from Homebrew | |
brew tap homebrew/dupes | |
brew 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 | |
brew cleanup | |
# Empty the .bash_path file that holds GNU paths | |
echo 'export PATH="/usr/local/sbin:$PATH"' > ~/.bash_path | |
# Build PATH variable script in ~/.bash_path | |
for i in /usr/local/Cellar/*/*/bin; do | |
echo 'export PATH="'$i':$PATH"' >> ~/.bash_path | |
done | |
for i in /usr/local/Cellar/*/*/libexec/gnubin; do | |
echo 'export PATH="'$i':$PATH"' >> ~/.bash_path | |
done | |
for i in /usr/local/Cellar/*/*/share/man; do | |
echo 'export MANPATH="'$i':$MANPATH"' >> ~/.bash_path | |
done | |
for i in /usr/local/Cellar/*/*/libexec/gnuman; do | |
echo 'export MANPATH="'$i':$MANPATH"' >> ~/.bash_path | |
done | |
wget https://raw.github.com/trapd00r/LS_COLORS/master/LS_COLORS -O $HOME/.dircolors | |
# Check if .bash_path is being called from .bash_profile | |
PATCH=`grep "~/.bash_path" ~/.bash_profile` | |
if [ "$PATCH" == "" ]; then | |
# Add Ubuntu-style PS1 to .bash_profile | |
cat <<EOF > ~/.bash_profile | |
alias ls="ls -ahl --color=always" | |
export PS1="\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]# " | |
EOF | |
# Add .bash_path to .bash_profile | |
cat > ~/.bash_profile << "EOF" | |
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" | |
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" | |
export PS1="\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]# " | |
eval `dircolors -b ~/.dircolors` | |
alias ls="ls --color=always" | |
alias grep="grep --color=always" | |
alias egrep="egrep --color=always" | |
source ~/.bash_path | |
EOF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment