Skip to content

Instantly share code, notes, and snippets.

@rsky
Created January 26, 2011 01:31
Show Gist options
  • Select an option

  • Save rsky/796049 to your computer and use it in GitHub Desktop.

Select an option

Save rsky/796049 to your computer and use it in GitHub Desktop.
Homebrewでインストールした共有ライブラリにリンクしているバイナリのリンク先を/usr/local/Cellar/Formula/Version/libから/usr/local/libに変更するシェルスクリプト
#!/bin/sh
otool -L "$1" \
| grep -F '/usr/local/Cellar' \
| perl -pe 's!^[ \t]+(/usr/local/Cellar/[^/]+/[^/]+/(.+?\.dylib)) \(.+$!install_name_tool -change "$1" "/usr/local/$2" "'"$1"'"!' \
| sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment