Getting Oauth Pecl to install on Mac OSX so I can do some Evernote Drupal module development work

Okay, so I wanted to start build a new version of the Evernote Drupal module, but when I attempted to get the sample working, I got a big error:


So, easy enough, right? Just install the thing. Apparently the correct thing to do is open up Terminal and type:

pecl install oauth

But when I did that, I got the error pecl: command not found. Because I'm using MAMP, though, I actually do have Pecl, it's just hidden in MAMP. So, I had to add the following to my ~./.bash_profile file:

export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:/bin:~/bin:/Applications/

Okay, cool. So now I can run Pecl. But, when I attempt the Oauth install, I get more errors including C compiler cannot create executables and ERROR: '/private/tmp/pear/temp/oauth/configure' failed.

Apparently, there's this application called gcc that does compiling, and at least in Mountain Lion on OSX, it doesn't come with the whole Xcode package like it used to. So, I set about trying to figure out the best way to get this back, and came upon this project on Github which is a nice pkg installer (for the technically slow like myself). This is a link to the PKG installer itself.

Then I ran the original command again (but I had to add sudo in order for it to work):

sudo pecl install oauth

And it worked! Holy s***! Now to get it registered with PHP, it says I need to add it to php.ini:

You should add "" to php.ini

So, I found my php.ini file by typing the following into the command line:

php -i

And then did a search in the terminal window for php.ini. In MAMP, it's apparently in /Applications/MAMP/bin/php/php5.3.6/conf. So I added the extension line to that.

Then I restarted MAMP to register the addition to php.ini.

And what do I get when I refresh my sample page?

Mother f-er!

Okay, so now I need to make sure that the php.ini file I just edited was the actual one that my site is using. So I opened up the index.php file in the Evernote example folder (/sample/oauth/index.php) and put in a little phpinfo(); at the top, then did a browser search for php.ini.

What's this? The php.ini file this is looking for is actually in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini. Oh that's right! MAMP PRO has you edit the php.ini file right in the application.

So, now I go to File > Edit Template > PHP > PHP 5.3.6 php.ini because that's where I intuitively thought it might be. Who wouldn't? I pasted the little extension line in there (after doing a search for extension= to find out where the other extensions were added), saved it, restarted MAMP (PRO), removed my  phpinfo() from the example page, refreshed, and…

Bam! I get some other error that lets me know that Oauth is actually functional. Sweet!

The PHP OAuth Extension is not installed