Occasionally removed all Brew links?
Subject
If you, like me (during RMagick gem and ImageMagick lib install) removed all Brew links from /usr/local/bin, use this script to generate them back:
$ find /usr/local/Cellar | grep bin/ > ./usr_bin_local
$ ruby -ne "s=\$_; p=s.match(/\/bin\/(.+)/); b=p[1] unless p.nil?; cmd=%Q(ln -s #{s.chomp} /usr/local/bin/#{b});`#{cmd}`" ./usr_bin_local
Explanation:
- 1st line finds all the bins in standart Brew packages installation directory on Mac OS X 10.7.x and saves them to 'usrbinlocal' file
- 2nd line runs ruby script, that finds bin name and creates link to its path in /usr/local/bin
- Profit!
Get a Gist:
$ git clone https://gist.github.com/4402228
Written by Denis Savitskiy
Related protips
2 Responses
Isn't brew list | xargs brew link
enough?
over 1 year ago
·
@sheerun, my script is for those, who have nothing in /usr/local/bin at all
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#