본문 바로가기

카테고리 없음

맥에서 루비 삭제되었을때

환경 

mac 10.10.4



현상 

맥미니를 재부팅후 루비가 갑자기 되지 않았다.
그래서 루비를 삭제하고 다시 설치하려고 /Library/아래에 루비를 강제 삭제 하엿다.

그래서 brew등 아무것도 루비가 없으니까 되지 않았다.

해결책 

이럴땐 아래와 같이 처리하면 루비를 재설치 할수 있다.

If you use Pacifist then it's possible to just reinstall Ruby.

  1. Insert your OS X DVD
  2. Run Pacifist
  3. Select "Open Apple Install Discs"
  4. Select the disc
  5. Search "Ruby.framework"
  6. Right click and select "Install to Default Location"

This will reinstall Ruby, to setup the symlinks from /usr/bin to point to it use Pacifist again:

  1. Search "Contents of BSD.pkg"
  2. Open: usr -> bin
  3. Select the links and files that you require
    • cap
    • capify
    • erb
    • ferret-browser
    • gem
    • gpgen
    • irb
    • mongrel_rails
    • rails
    • rake
    • rb-keygen
    • rdoc
    • redcloth
    • ri
    • ruby
    • testrb
    • update_rubygems
  4. Right click and select "Install to Default Location"

In general if you need to figure out what installer a file came from on your system in a terminal:

$ pkgutil --file-info /usr/bin/ruby
volume: /
path: usr/bin/ruby

pkgid: com.apple.pkg.BSD
pkg-version: 10.5.0.1.1.1188305148
install-time: 1203610823
uid: 0
gid: 0
mode: 120755

The pkgid should then give you a hint, and then you either find that installer and run it again or use Pacifist to selectively do it.

You can also see what other files are in that package with:

$ pkgutil --files com.apple.pkg.BSD
.
Library
Library/Documentation
Library/Documentation/Commands
Library/Documentation/Commands/grep
...

I've found the best way to deal with Ruby on OS X is to get your system to the default state with the above process. Remove any MacPort, Fink or versions you have manually compiled. Install RVM and use that to manage installing newer versions.


Turns out that I had removed my system Ruby and had problems installing pow (http://pow.cx) on my mac because of it. So I installed Pacifist and followed the advice in this post and am back in business. Thanks!


이것을 다끝내고 난후 rvm으로 새로운 버젼 설치하면된다.