Skip to content

Instantly share code, notes, and snippets.

@leptos-null
Last active April 4, 2023 18:48
Show Gist options
  • Save leptos-null/43298878fd4da5c07084022e423feb92 to your computer and use it in GitHub Desktop.
Save leptos-null/43298878fd4da5c07084022e423feb92 to your computer and use it in GitHub Desktop.
Using cycript on macOS Mojave

Cycript on Mojave

Cycript is a tool I find very helpful. It's an effective REPL for Objective-C. When I updated to macOS Mojave, I found that cycript no longer worked because it was linked against an old version of Ruby. After attempting to compile from source, I tried another solution. install_name_tool is an open source tool for modifying the names of linked shared libraries in a Mach-O.

Solution

$ install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.dylib Cycript.lib/cycript-apl
$ install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.dylib Cycript.lib/libcycript.dylib
@funcoleto
Copy link

also work is you put this file "/usr/local/Cellar/ruby/3.1.1/lib/libruby.3.1.dylib" with this name (you need to change name) "libruby.2.0.0.dylib" in folder "cycript_0.9.594/Cycript.lib/libruby.2.0.0.dylib"

@jauharvp
Copy link

jauharvp commented Apr 13, 2022

cycript_0.9.594 ./cycript [1] 37506 killed ./cycript ➜ cycript_0.9.594

The above workaround is not working for me. @crifan @funcoleto

System Version: macOS 12.2.1

@Raeein
Copy link

Raeein commented Oct 5, 2022

finally worked by:

  1. brew install ruby installed /usr/local/Cellar/ruby/3.1.1
  2. copy 3.1.1 lib into cycript's libruby.2.0.0.dylib
  • cp /usr/local/Cellar/ruby/3.1.1/lib/libruby.3.1.dylib /opt/cycript/Cycript.lib/libruby.2.0.0.dylib

Worked like a charm. Thank you 👍

@kuustudio
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment