Skip to content

Quick tip for better iOS device security

20140405-105002.jpg

If you disable the “simple passcode” your iOS device will ask you for a complex passcode. If you only enter digits as your “complex” passcode then you phone or iPad will always show the number entering keyboard making it a lot easier to enter the security code. So if your passcode is made up of numbers alone the full keyboard is not shown.

20140405-110241.jpg

Nice and simple way to move beyond the four digit PIN but still keep it easy to use!;

Mac OSX 10.8.x Broken links in Frameworks and Application Crashes

I stil haven’t figured out why, but my Mac OSX 10.8.4, and lower keeps corrupting file system links all over the place. As you can read in my Microsoft Office posts this problem has plagued me since I first installed 10.8, and happens without any apparent reason.
The only symptoms are that some applications, like Office, QuickTime, Skype and others just don’t start and crash all the time.

Skype gives out an interesting message saying that it needs QuickTime version X to run and crashes, and when I tried to run QuickTime it crashed too.
This happened right after I installed Adobe Air and Salesforce Chatter.

The one thing these crashes have in common is the error they issue. In the crash report you should see something like this:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

Before you spend your day reinstalling the OS and applications from ZERO, try this:

sudo find -L /Applications -type l
sudo find -L /System/ -type l
sudo find -L ~/Library -type l

These commands will search for and report all broken links in the Applications, System, and User Library directories, and you should see a bunch of output like this

/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LangAnalysis.framework/Headers
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/SpeechSynthesis.framework/Headers
/System/Library/Frameworks/ApplicationServices.framework/Headers

Once you fix all these broken links your applications will start working once again

Here is a perl script that can automate the process.

#!/usr/bin/perl
# This script fixes broken Apple Mac OSX 10.8 framework links
# Author:  BigDiver
# Version 1.0
# Date: 09/04/2013
use strict;

my $base_dir = $ARGV[0];
my $test = $ARGV[1];

use File::Find ();
use File::Find::Rule;

die("Dir not found: " . $base_dir) if( ! -d $base_dir );
my %broken;
my $user = `whoami`;
chomp $user;

if( $user !~ /root/i ) {
    print "Script running as user $user\n";
    print "You must run this script as root. Try sudo $0\n";
    exit(-1);
}
    
print "Scan Directory: $base_dir\n";

# Calling wanted subroutine which use stat function to match broken links
File::Find::find({wanted => \&find_broken_links}, $base_dir); 

foreach my $d (keys %broken) {
    print "Fixin $d\n";
    
    foreach my $broken_link ( @{ $broken{$d} }) {
        
        if ($broken_link =~ /Current$/) {
            my $versions_dir = $d . "/Versions";
            
            # Current link is damaged lets point it back to the latest version
            my @dirs = get_all_directories( $versions_dir);
            
            if ( scalar @dirs == 0 ) {
                print "There are no versions available\n";
                next;
            }
            
            # Get highest version
            my $top_version = $dirs[0];  # Directories sorted in reverse order...
                
            #print "Working on $versions_dir\n";
            chdir($versions_dir);
            
            print "$top_version -> $broken_link\n";
            if ( !$test) {
                unlink $broken_link
                    or die "Could not unlink $broken_link";
            
                symlink $top_version, $broken_link
                    or die "Could not link $broken_link";
            }
            
        }
        else {
            my $l = readlink $broken_link;
            
            my $broken_path = $broken_link;
            $broken_path =~ s/\/[^\/]+$//;
            
            
            if( $broken_path eq $d && $l !~ /Versions/) {
                # if not pointing to the current version lets fix it
                
                $broken_link =~ /\/([^\/]+)$/;
                my $whats_broken = $1;
                
                #print "Working on $d\n";
                chdir($d);
                
                print "Versions/Current/$whats_broken -> $broken_link\n";
                if ( !$test) {
                    unlink $broken_link
                        or die "Could not unlink $broken_link";
                    symlink "Versions/Current/$whats_broken", $broken_link
                        or die "Could not link $broken_link";
                }
                
            }    
        }
    }
    
}
print "Done\n";


sub find_broken_links {
    my $file = $_;
    if (-l $file) {
        my $target = readlink $file;
        if ( ! -e $target && ! -l $target ) {
            my $dir = $File::Find::dir;
            $dir =~ s/\.framework((?!framework).)+$/\.framework/;
            if ($dir =~ /\.framework/ ) {
                push @{ $broken{$dir} }, $File::Find::dir . "/" . $file;
            }
        }
    }
}

sub get_all_directories {
    my ($root) = @_;
    
    my $rule = File::Find::Rule->new;  
    my @dirs = $rule
        ->maxdepth(1)
        ->not(File::Find::Rule->new->name(qr/^\.\.?$/))
        ->directory
        ->relative
        ->in($root);
    
    return reverse sort @dirs;
}

Save it to a file, say fixlinks.pl, and make it executable like this

chmod 755 fixlinks.pl

Now you can run fixlinks.pl with the directory you want to scan and fix broken links.

sudo ./fixlinks.pl /System
sudo ./fixlinks.pl /Applications
sudo ./fixlinks.pl ~/Library

If you just want to test what the script would do, but not actually do it run it like this:

sudo ./fixlinks.pl /System 1

Notice the ‘1’ as the last argument. This disables all system changes.

I am not responsible for any data loss, so use this at your own risk. If it works great, if it doesn’t keep Googling for a solution🙂

Fix Homebrew (brew) Broken Links on 10.8

I was getting some brew errors like

Error: pathname contains : “000400\203\260>000400\261\260>000006et_user_reg00\320\26003ub_cc00\364\26003b”

All homebrew files are install in the /usr/local directory so I searched there for broken links with the command:

cd /usr/local
find -L . -type l

The result was the following:

./opt/gnutls
./opt/jpeg
./opt/libffi
./opt/libtasn1
./opt/nettle
./opt/p11-kit
./opt/pixman
./opt/pkg-config
./opt/xz

The output indicated that all broken links were located in the /usr/local/opt folder.

Example bad link:

lrwxr-xr-x   1 user  staff    23B Jan  2  2013 autoconf@ -> ../Cellar/autoconf/2.69
lrwxr-xr-x   1 user  staff    23B Jul 15 20:25 automake@ -> ../Cellar/automake/1.14
lrwxr-xr-x   1 user  staff    24B Jul 15 20:26 gettext@ -> ../Cellar/gettext/0.18.3
lrwxr-xr-x   1 user  staff    21B Jul  7 00:49 glib@ -> 
lrwxr-xr-x   1 user  staff    19B Jul  7 00:41 gmp@ -> ../Cellar/gmp/5.1.2
lrwxr-xr-x   1 user  staff    23B Jul 15 21:24 gnutls@ -> ../Cellar/gnutls/3.1.10
lrwxr-xr-x   1 user  staff    17B Jul  6 20:36 jpeg@ -> ???????$d???????q
lrwxr-xr-x   1 user  staff    23B Jul  9 01:32 libffi@ -> z?{?|?}?~???
lrwxr-xr-x   1 user  staff    22B Jul  9 01:32 libtasn1@ -> ??????????????????????

So I ran the following commands:

cd /usr/local/opt
unlink [formula]
ln -s ../Cellar/[formula]/[version] [formula]

Where [formula] is the link name and [version] is one of the version directories you have under the ../Cellar/[formula] directory.

Do the same for all “formulas” that have broken links and brew starts working again.
After you are done your /usr/local/opt directory should like this:

lrwxr-xr-x   1 user  staff    23B Jan  2  2013 autoconf@ -> ../Cellar/autoconf/2.69
lrwxr-xr-x   1 user  staff    23B Jul 15 20:25 automake@ -> ../Cellar/automake/1.14
lrwxr-xr-x   1 user  staff    24B Jul 15 20:26 gettext@ -> ../Cellar/gettext/0.18.3
lrwxr-xr-x   1 user  staff    22B Jul 15 21:25 glib@ -> ../Cellar/glib/2.36.3/
lrwxr-xr-x   1 user  staff    19B Jul  7 00:41 gmp@ -> ../Cellar/gmp/5.1.2
lrwxr-xr-x   1 user  staff    23B Jul 15 21:24 gnutls@ -> ../Cellar/gnutls/3.1.10
lrwxr-xr-x   1 user  staff    18B Jul 15 21:25 jpeg@ -> ../Cellar/jpeg/8d/
lrwxr-xr-x   1 user  staff    23B Jul 15 21:26 libffi@ -> ../Cellar/libffi/3.0.13
lrwxr-xr-x   1 user  staff    22B Jul 15 21:26 libtasn1@ -> ../Cellar/libtasn1/3.3

Pain in the butt…

Microsoft Office Mac Crashes Automated Fix

Perl Script to fix Microsoft Office 14 on MAC OSX 10.8.
Please check this other post for more details.

#!/usr/bin/perl
# This script checks the filenames in a directory and report for any broken symbolic links
# Author: BigDiver
# Version 1.0
# Date: 03/26/2013

# Office version
my $version = 14;

# Office install directory
my $office_dir = "/Applications/Microsoft Office 2011/";

use File::Find ();

die("Dir not found: " . $office_dir) if( ! -d $office_dir );
my %broken;
my $user = `whoami`;
chomp $user;

if( $user !~ /root/i ) {
    print "Script running as user $user\n";
    print "You must run this script as root. Try sudo $0\n";
    exit(-1);
}

print "Office Directory: $office_dir\n";
print "Office Version: $version\n";

File::Find::find({wanted => \&wanted}, $office_dir); # Calling wanted subroutine which use stat function to match broken links

foreach $d (keys %broken) {
    print "Fixin $d\n";
    unlink $d . "/Resources";
    symlink "$d/Versions/$version/Resources", "$d/Resources";
    unlink "$d/Versions/Current";
    symlink "$d/Versions/$version", "$d/Versions/Current";
}
print "Done\n";

sub wanted {
    my $file = $_;
    if (-l $file) {
        my $target = readlink $file;
        if ( ! -e $target && ! -l $target ) {
            my $dir = $File::Find::dir;
            $dir =~ s/\.framework.+$/\.framework/;
            $broken{$dir} = 1;
        }
    }
}

Save this and run as root.

Good Luck!

Microsoft Office Mac Suddenly Stops Working – FIX!

Update: check this newer post for an Perl script that fixes all directories at once. Keep reading for details on why this problem happens and what the script is doing.

After combing the web for an explanation to why my Microsoft Office Mac suddenly stopped working with several errors similar to

Process:         Microsoft Excel [12421]
Path:            /Applications/Microsoft Office 2011/Microsoft Excel.app/Contents/MacOS/Microsoft Excel
Identifier:      com.microsoft.Excel
Version:         14.2.5 (14.2.5)
Build Info:      Unknown-121010~0
Code Type:       X86 (Native)
Parent Process:  launchd [145]
User ID:         501

Date/Time:       2012-12-10 15:52:31.708 -0500
OS Version:      Mac OS X 10.8.2 (12C60)
Report Version:  10

Interval Since Last Report:          9 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  1 sec
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000

VM Regions Near 0:
--> __PAGEZERO 0000000000000000-0000000000001000 [ 4K] ---/--- SM=NUL /Applications/Microsoft Office 2011/Microsoft Excel.app/Contents/MacOS/Microsoft Excel
VM_ALLOCATE 0000000000001000-00000000000b4000 [ 716K] ---/--- SM=NUL

and not finding a solution other than a full manual, and laborious, unistall and followed by a fresh install I decided to look deeper into the issue. By running each Office little helper applications, like Microsoft Query.app (in the /Applications/Microsodt Office 2011/Office/), I found that one of them reported MicrosoftComponentPlugin.framework as “non existent”.

By listing the contents of /Applications/Microsodt Office 2011/Office/MicrosoftComponentPlugin.framework I saw that some of the symbolic links were broken. That gave me the hint to figure out what was going on – for some strange reason the links of several files in the Office directory were being corrupted.
To fix the problem you just need to find all broken links and then fix them one by one

cd /Applications/Microsoft\ Office\ 2011/Office/
find -L . -type l

You should see a list of all the broken links. Like this

find -L . -type l
./MSXML.framework/MSXML
./MSXML.framework/Versions/Current
./MViewLib.framework/MViewLib
./MViewLib.framework/Resources
./MViewLib.framework/Versions/Current
./OfficeArt.framework/OfficeArt
./OfficeArt.framework/Resources
./OfficeArt.framework/Versions/Current
./SmartArt.framework/Resources
./SmartArt.framework/SmartArt
./SmartArt.framework/Versions/Current
./wlmstrings.framework/Resources
./wlmstrings.framework/Versions/Current
./wlmstrings.framework/wlmstrings

Now you need to change to each directory and fix the links. You can do this manually, but since the problem was the same in all directories I wrote a small shell script that helps in this process. All you need to do is to run the script inside the main directory where the links are broken. So taking the list of broken links above notice that there are 3 broken links in each directory. The script fixes the 3 links at once, so you only need to run it once in each directory.
Here it is:

#!/bin/bash

OFFICE="/Applications/Microsoft Office 2011/Office/"
VERSION="14"
RESOURCES="Versions/$VERSION/Resources"

echo "Settings"
echo "Office Directory   : $OFFICE"
echo "Office Version     : $VERSION"
echo "Resources Directory: $RESOURCES"
echo 

sudo unlink Resources
sudo ln -s $RESOURCES Resources
cd Versions
sudo unlink Current
sudo ln -s $VERSION Current  
cd ..

Copy & Paste this to a text file (call it fixoffice.sh), and make if executable by running

chmod 700 fixoffice.sh

If your Office version is different change the VERSION variable. You can determine the version by listing the content of the Version sub folders of the folders with broken links. Example:

ls -als ./MSXML.framework/MSXML/Version

You should see something like:

drwxrwxr-x  4 root  wheel   136B Dec 27 14:50 ./
drwxrwxr-x  5 root  wheel   170B Dec 27 15:01 ../
drwxrwxr-x  6 root  wheel   204B Dec 10 17:15 14/
lrwxr-xr-x  1 root  wheel     2B Dec 27 14:50 Current@ -> ?:?

Notice the “?:?” (or similar) in the Current link. If all was ok Current should point to folder “14” (in this example) which also is the Office version you have installed.

To fix the links run the fixoffice.sh inside the folder that has the broken links.

Once the links are corrected the folder should look like this:

drwxrwxr-x    5 root  wheel   170B Dec 27 15:01 ./
drwxrwxr-x  109 root  wheel   3.6K Dec 10 17:12 ../
lrwxr-xr-x    1 root  wheel    41B Dec 10 17:04 MicrosoftComponentPlugin@ -> Versions/Current/MicrosoftComponentPlugin
lrwxr-xr-x    1 root  wheel    22B Dec 27 15:01 Resources@ -> Versions/14/Resources/
drwxrwxr-x    4 root  wheel   136B Dec 27 14:50 Versions/

After you fix all the links in all the folders returned by the find command your Microsoft Office will work once again!

If you’d like to contribute a script that automates the total process you’ll be considered a “Rock Star”
Good luck. Let me know if this works for you.

Working with Ruby Version Manager

You should first install the Ruby Version Manager (RVM), you can follow my other article on how to do it and get the latest version of Ruby and Rails working on your Mac.

Once you have RVM you can change Ruby versions at will. For a full documentation of RVM you can go the the website.

This article is in no way a full on manual but a set of quick tips on how to get going, and best practices. So we’ll see how to:

  1. Choose a Ruby version
  2. Gemsets and their basic functionality
  3. How to use gemsets with rails projects

Choose a Ruby Version

To select a working version of Ruby you can do


bigdiver$ rvm use 1.9.3
Using /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0

Then you can verify that you’re really using that version by running


bigdiver$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
bigdiver$ which ruby
/Users/bigdiver/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

Notice that we’re using the ruby installed in the user’s home directory (~/.rvm)and not the system’s which is in /usr/bin.

Gemsets

The next thing to get familiar with are gemsets. RVM gives you a compartmentalized ruby environment that is independent of the other versions on the system. This is great because it gives you full control over the gem, or package, versions your projects needs to function properly.
A huge part of that compartmentalization are the RVM gemsets. Gemsets are groups of Ruby Gems, that are associated with a version of ruby managed by RVM. You can think of them as gem repositories. You should have one gemset per project, and that’s where RVM really shines, because it makes the process really easy.

You can list the existing gemsets with the command


bigdiver$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0)
global

At this point, and if you just installed RVM you should only have one global gemset, you can choose by using the command gemset use


bigdiver$ rvm gemset use global
Using /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0 with gemset global
bigdiver$ rvm gemset name
global
bigdiver$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0)
=> global

Both gemset name and gemset list show the current gemset.

To create a gemset you run the command


bigdiver$ rvm gemset create repo1
'repo1' gemset created (/Users/bigdiver/.rvm/gems/ruby-1.9.3-p0@repo1).
bigdiver$ rvm gemset use repo1
Using /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0 with gemset app4

Easy. Repo1 gemset was created and selected for use. Notice the notation 1.9.3@repo1? This indicates that we created the repo1 gemset “under” or “at” the “1.9.3” ruby version. By default RVM creates the gemset under the current ruby version (the one you chose with rvm use command).

You can abbreviate the two commands above with the –create option.


bigdiver$ rvm --create 1.9.3@repo2
bigdiver$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0)
repo1
=> repo2
global

As you can see the hash-rocket (=>) now points to the newly created repo2 indicating that it is the selected gemset.

All the gem operations you make, like gem install, etc will only affect the current gemset.

The exception to this is the global gemset, which as the name indicates, is global to the ruby version in use. So all the gems installed to global will be available in all other gemsets created under this version. This is a very good thing since it saves us a lot of time and work when creating new projects.

Using Gemsets with Rails

I usually create a rails directory where all the projects go. And create a gemset per project. You should create the gemset and select it before creating the new rails application.

Let’s do it:

bigdiver$ mkdir ~/work/rails/
bigdiver$ cd ~/work/rails
bigdiver$ rvm --create app1
bigdiver$ rails new app1

If rvm, ruby and rails were properly installed all the commands should run without error, and the Bundler will install a bunch of new gems into the app1 gemset repository.

Now you’re ready for some RVM magic! Lets create a .rvmrc file so that RVM changes to the app1 gemset as soon as we enter, or cd, to the app1 directory.


bigdiver$ cd app1
bigdiver$ rvm --rvmrc 1.9.3@app1

Again we’re using the @ syntax. This creates a .rvmrc file in the current directory, which was ~/work/rails/app1. Now all you need to do is exit from the directory and jump back in again.


bigdiver$ cd ..
bigdiver$ cd app1

==============================================================================
= NOTICE =
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory =
= This is a shell script and therefore may contain any shell commands. =
= =
= Examine the contents of this file carefully to be sure the contents are =
= safe before trusting it! ( Choose v[iew] below to view the contents ) =
==============================================================================
Do you wish to trust this .rvmrc file? (/Users/bigdiver/work/rails/app1/.rvmrc)
y[es], n[o], v[iew], c[ancel]> Yes

Answer Yes to trust the current .rvmrc file, and you’re done. Now every time you change to the app1 directory the 1.9.3@app1 gemset is selected automatically. Nice!

I also create a .rvmrc file in the rails directory that points to the global gemset, so when I want to install gems globally all i need to do is cd .. from any project.


bigdiver$ cd ..
bigdiver$ rvm --rvmrc 1.9.3@global
bigdiver$ cd ..
bigdiver$ cd rails
==============================================================================
= NOTICE =
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory =
= This is a shell script and therefore may contain any shell commands. =
= =
= Examine the contents of this file carefully to be sure the contents are =
= safe before trusting it! ( Choose v[iew] below to view the contents ) =
==============================================================================
Do you wish to trust this .rvmrc file? (/Users/bigdiver/work/rails/global/.rvmrc)
y[es], n[o], v[iew], c[ancel]> yes
Using: /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0@global

Try it out


bigdiver$ cd app1
Using: /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0@app1
bigdiver$ cd ..
Using: /Users/bigdiver/.rvm/gems/ruby-1.9.3-p0@global

Neat.

Update Ruby and Rails on Mac OS X

The system version of Ruby is a bit outdated. In order to update it you should install the Ruby Version Manager or RVM, and not touch the System’s Ruby version. Trying to install it through MacPorts also gave me a bunch of problems, especially in OS X Lion (10.7).

This install also requires Git Version Control system.
If you’re using MacPorts you can install it by running

sudo port install git

But like I said some Ruby and Rails applications do not play well with MacPorts so you will sooner or later should migrate to Homebrew. Here is one of such problems due to mismatched OpenSSL MacPort library versions, that caused me to have to reinstall the whole thing…

Well using the system’s version of ruby it is easy to install Homebrew:

ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"

and then install Git

brew install git

Now you can install RVM. Just Copy & Paste the whole line and run it as a single line in your terminal

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

I usually install RVM in my home directory, and run the previous command with my regular user. This is ok since we mostly use our Macs for development, with only one developer on that machine.

If you need to install RVM system wide you can run:

sudo bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

Now you need to add RVM to your shell so it can do its magic.

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile

Close your Terminal and reopen it. This will force it to process the code we just entered into .bash_profile. You can also run the following:

. ~/.bash_profile

Now you need to make sure you have the latest Xcode from Apple. You can download it from the App Store for free, or install it from your Mac OS X installation DVD.

If you are a die hard fan of MacPorts, please remove it from the PATH so Ruby does not compile against its libraries causing all sorts of errors later on. It usually suffices to remove all references to /opt/local from the /etc/profile, but your configuration maybe a little bit different.

Now that you have installed Xcode and removed the MacPorts from the PATH you can continue🙂

At the time of this writing the current stable version of Ruby was 1.9.3 so that is what I use, you should probably use the latest sable version, and not 1.9.3, by the time you follow this procedure…

rvm install 1.9.3

If you’re on Mac OS X Lion 10.7.2 with Xcode 4.2.1 you may get a compilation error. In that case run

rvm install 1.9.3 --with-gcc=clang

Once it finishes downloading, compiling and installing ruby you can do

rvm --default use 1.9.3

To use the ruby version we just installed, and to make it the default version.

RVM is kind of neat since it does not disturb the system version of Ruby and allows you to maintain and work with different versions of Ruby so you can make sure your older projects that require older versions of Ruby, Rails or some other Gem still run even when you upgrade to newer versions.

RVM is kind of like a virtual machine, or environment that allows you to keep separate Ruby installs that will coexist peacefully, and that is why you should use it and not replace the system Ruby version.

RVM allows for the creation and use of several Gem Repositories or gemsets, that you can keep for each of your projects, and this is an invaluable feature so you don’t get stuck into gem dependency issues later on.

By default a global gemset is created and all gems installed to global will be shared among all the other gemsets that you create for a specific ruby version maintained by RVM.
You should install gems, that like Rails, will be shared by all projects running under a Ruby version. So lets install some of the basic gems to get us going.


rvm gemset list

You should get something like:


gemsets for ruby-1.9.3-p0 (found in /Users/pedro/.rvm/gems/ruby-1.9.3-p0)
global

Lets double check that we’re using the Ruby version we just installed:


bigdiver$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
bigdiver$ gem -v
1.8.10

Nice!
Install sQlite3, JSON, and Rails


gem install sqlite3 json rdoc rails cheat

If you get UTF-8 errors just set the LANG and LC_CTYPE environment variables. I usually do it in the /etc/profile, but you can do it in the .bash_profile in your home directory.
Add the following lines to one of them and “source” them into your environment


export LC_CTYPE="utf-8"
export LANG=en_US.UTF-8

. /etc/profile

or

. ~/.bash_profile

And then install your gems.

Follow

Get every new post delivered to your Inbox.