Rubygems: Rebuild native extensions

Reposted after “makandropedia”:

Rarely, you might want to rebuild all gems with native extensions, because they might be compiled against outdated system libraries, resulting in some warnings or even segfaults or other ruby errors.

You can do that using

gem pristine --all

This will reset all gems to a pristine state as if you’d reinstall them, and as a side effect, rebuild all native extensions.

The above command will also help you sorting out errors like this after a distribution upgrade: cannot open shared object file: No such file or directory - /home/henning/.rvm/gems/ruby-1.8.7-p358/gems/mysql2-0.3.11/lib/mysql2/

(Because the library which is used to compile the gem doesn’t exist anymore and you have to recompile it.)

This entry was posted in Coding, Rails and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s