Last active
January 18, 2025 16:17
-
-
Save clayfreeman/2a5e54577bcc033e2f00 to your computer and use it in GitHub Desktop.
GNU-ize Mac OS X El Capitan
This file contains hidden or 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 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 | |
# 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 ll="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 | |
echo "source ~/.bash_path" >> ~/.bash_profile | |
fi |
It currently will override my bash profile:
cat <<EOF > ~/.bash_profile
Can you changed it to
cat <<EOF >> ~/.bash_profile
FYI, I import this to a repository in https://github.com/ickc/GNU-ize
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have some issues with this code:
HTH, just my 2 cents