Bookmark and Share

History

  • Last content verification: 2017-5-1, macOS 10.12.4, Homebrew 1.2.0.

macOS

If you've installed any of the softwares before, but would like to re-install it, (possibly because you want to make sure it's installed with the options such as --with-default-names, use brew reinstall ... in place of brew install.

GNU core utilities

The GNU Core Utilities (coreutils) contains "the basic file, shell and text manipulation utilities of the GNU operating system."

brew install coreutils

Other GNU utilities

Run the following if not already in the past:

brew tap homebrew/dupes

Install utilities:

brew install binutils
brew install diffutils
brew install ed --with-default-names
# brew install findutils --with-default-names ## This will cause 'brew doctor' to issue warning: "Putting non-prefixed findutils in your path can cause python builds to fail."
brew install findutils
brew install gawk
brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
brew install gnu-tar --with-default-names
brew install gnu-which --with-default-names
brew install gnutls
brew install grep --with-default-names
brew install gzip
brew install screen
brew install watch
brew install wdiff --with-gettext
brew install wget
brew install gnupg
brew install gnupg2

The following utilities already exist on macOS, but install the newest version from Homebrew:

brew install bash
brew link --overwrite bash
# brew install emacs
brew install --cocoa --srgb emacs ## 
brew linkapps emacs
brew install gdb  # gdb requires further actions to make it work. See `brew info gdb`.
brew install guile
brew install gpatch
brew install m4
brew install make
brew install nano

macOS has the following non-GNU utilities, but you can install and use a newer version instead of the version shipped by macOS:

brew install file-formula
brew install git
brew install less
brew install openssh
brew install rsync
brew install svn
brew install unzip
brew install vim --override-system-vi
brew install macvim --with-override-system-vim --custom-system-icons
brew link --overwrite macvim
brew linkapps macvim
brew install zsh

Install Perl:

brew tap homebrew/versions
brew install perl518   # must run "brew tap homebrew/versions" first!

Install Python:

brew install python
brew linkapps python
pip install --upgrade pip setuptools

Configuration in .bashrc

If installed GNU utilities without using the default names:

brew install ed #--with-default-names
brew install findutils #--with-default-names
brew install gnu-indent #--with-default-names
brew install gnu-sed #--with-default-names
brew install gnu-tar #--with-default-names
brew install gnu-which #--with-default-names
brew install grep #--with-default-names

i.e., installing them without the --with-default-names option, Homebrew will install the formulae with the prefix "g". If you still need to use these commands with their normal names, you can add a "gnubin" directory to your PATH in file ~/.bashrc:

PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
... # possibly others

Additionally, to make the man pages of the GNU versions of the utilities accessible via their normal names, add the gnuman directory to the MANPATH variable in the file ~/.bashrc:

MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH"
MANPATH="/usr/local/opt/gnu-tar/libexec/gnuman:$MANPATH"
... # possibly others

But I recommend installing with the --with-default-names option whenever applicable.

It seems --with-default-names is not applicable to the coreutils package, so

PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

always need to be applied.

Homebrew "caveats" and post-installation configuration

  • gdb

gdb requires special privileges to access Mach ports. You will need to codesign the binary. For instructions, see:

http://sourceware.org/gdb/wiki/BuildingOnDarwin

  • openssl and certificates

      $ brew install wget
      ==> Installing wget dependency: openssl
      ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2a-1.yosemite.bottle.1.tar.gz
      ######################################################################## 100.0%
      ==> Pouring openssl-1.0.2a-1.yosemite.bottle.1.tar.gz
      ==> Caveats
      A CA file has been bootstrapped using certificates from the system
      keychain. To add additional certificates, place .pem files in
        /usr/local/etc/openssl/certs
    
      and run
        /usr/local/opt/openssl/bin/c_rehash
    
      This formula is keg-only, which means it was not symlinked into /usr/local.
    
      macOS already provides this software and installing another version in
      parallel can cause all kinds of trouble.
    
      Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
    
      Generally there are no consequences of this for you. If you build your
      own software and it requires this formula, you'll need to add to your
      build variables:         
          LDFLAGS:  -L/usr/local/opt/openssl/lib
          CPPFLAGS: -I/usr/local/opt/openssl/include
      ==> Summary
      🍺  /usr/local/Cellar/openssl/1.0.2a-1: 463 files, 18M
      ==> Installing wget
      ==> Downloading https://homebrew.bintray.com/bottles/wget-1.16.3.yosemite.bottle.tar.gz
      ######################################################################## 100.0%
      ==> Pouring wget-1.16.3.yosemite.bottle.tar.gz
      🍺  /usr/local/Cellar/wget/1.16.3: 9 files, 1.5M
      $
    
  • Git

      $ brew install git
      ==> Downloading https://homebrew.bintray.com/bottles/git-2.4.0.yosemite.bottle.tar.gz
      ######################################################################## 100.0%
      ==> Pouring git-2.4.0.yosemite.bottle.tar.gz
      ==> Caveats
      The macOS keychain credential helper has been installed to:
        /usr/local/bin/git-credential-osxkeychain
    
      The "contrib" directory has been installed to:
        /usr/local/share/git-core/contrib
    
      Bash completion has been installed to:
        /usr/local/etc/bash_completion.d
    
      zsh completion has been installed to:
        /usr/local/share/zsh/site-functions
      ==> Summary
      🍺  /usr/local/Cellar/git/2.4.0: 1368 files, 31M
      $
    
  • sqlite

      $ brew install sqlite
      ==> Installing subversion dependency: sqlite
      ==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.10.1.yosemite.bottle.tar.gz
      ######################################################################## 100.0%
      ==> Pouring sqlite-3.8.10.1.yosemite.bottle.tar.gz
      ==> Caveats
      This formula is keg-only, which means it was not symlinked into /usr/local.
    
      macOS already provides this software and installing another version in
      parallel can cause all kinds of trouble.
    
      macOS provides an older sqlite3.
    
      Generally there are no consequences of this for you. If you build your
      own software and it requires this formula, you'll need to add to your
      build variables:
          LDFLAGS:  -L/usr/local/opt/sqlite/lib
          CPPFLAGS: -I/usr/local/opt/sqlite/include
      ==> Summary
      🍺  /usr/local/Cellar/sqlite/3.8.10.1: 9 files, 2.8M
    

svn

$ brew install svn
==> Installing subversion
==> Downloading https://homebrew.bintray.com/bottles/subversion-1.8.13.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring subversion-1.8.13.yosemite.bottle.tar.gz
==> Caveats
svntools have been installed to:
  /usr/local/opt/subversion/libexec

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/subversion/1.8.13: 116 files, 9.4M
$

(Ubuntu) Linux

There are only some of the command-line utilities which are not usually already installed:

sudo apt-get install indent
sudo apt-get install gnupg2
sudo apt-get install python-pip
sudo pip install --upgrade pip setuptools

References

  • https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
blog comments powered by Disqus