Popcorn
Popcorn

Reputation: 5348

How can I restore /System/Library/Frameworks/Ruby.framework/Versions/1.8 on Mac OS?

I deleted /System/Library/Frameworks/Ruby.framework/Versions/1.8 and a lot of things are now messed up.

What is the easiest way to restore this directory?

I'm trying to install ruby back by using brew install ruby but brew is no longer working:

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0`

Some other things that may help:

$rvm list
rvm rubies

   ree-1.8.7-2011.12 [ missing bin/ruby ]
   ruby-1.9.3-p484 [ x86_64 ]

# Default ruby not set. Try 'rvm alias create default <ruby>'.

# => - current
# =* - current && default
#  * - default

Ruby related:

$which ruby
$which -a ruby
$ruby
-sh: ruby: command not found

I am running OS X 10.8.4

If reinstalling the default ruby is not possible without reinstalling the OS, is there a way to get around this problem? Perhaps by installing newer versions of ruby and using that as my default instead?

Upvotes: 3

Views: 7281

Answers (1)

James
James

Reputation: 4706

I'm still working on the complete procedure, but I will write steps as I proceed on my side.

  1. Get Pacifist from here: http://www.charlessoft.com

  2. From Pacifist launch screen, select the last action at the bottom (my system is in French, so I don't know the exact action text... should be something like "Examinate installation receipts")

  3. On the next screen, in the drop down menu in the top left corner, select "Full path", then type: "/System/Library/Frameworks/Ruby.framework/Versions/1.8/", and finally click "Search"

  4. From the search result screen, you will have to examine proposed installation packages. Just click one, then click "Inspect selected receipt".

  5. Navigate in the installation package's tree down to /System/Library/Frameworks/Ruby.framework/Versions/1.8/, and check if that folder appears to be complete. It should contain a _codesignature directory, Resource, a Ruby executable, usr/bin, and so on. If it doesn't go back at step 4, and select another receipt.

Note that here, the correct receipt appears to be "Essentials". Take note of that name.

  1. Now, come back to Pacifist's main menu, and select "Open Apple Installers". You will be proposed to redownload Apple installer for your operating system. Yes, you'll have to do so, unless you already have OS X 10.8 installer lying somewhere around...

  2. Once the download is completed, you will have to locate the installation package for the name that you identified previously. So I would search for essentials.pkg. Navigate through it down to /System/Library/Frameworks/Ruby.framework/Versions/ . Select subfolder "1.8", then right click and choose "Reinstall in it's default location".

That should be it. Note though that I couldn't test the last step by myself.

Good luck, and please... Don't do that again.

Upvotes: 5

Related Questions