4 Easy Steps to Free Up Space on your Mac OS X Hard Drive

My hard drive space was rapidly depleting on my MacBook Pro, and needed to free up some space quickly. I decided to crowd source the answer, and my #lazyweb tweet resulted in some great pointers from my friends @markjaquith, @80085, and @lesmothian.

Here is how I freed over 16gb of space on my OS X Startup Disc.

Continue reading ‘4 Easy Steps to Free Up Space on your Mac OS X Hard Drive’

Hello There! Thank you for visiting my site.

This is the professional blog of Eric Marden, a veteran web developer, entrepreneur, and inspirational speaker.

If you're new here, please subscribe to my RSS feed. You'll get a blend of tech news, analysis, inspirational essays, and much more. Subscribe today.

Installing FUSE + s3fs and sshfs on Ubuntu

Fuse is a program to mount ‘foreign’ filesystems to your computer. This is how I got an Amazon S3 (simple storage service) bucket mounted on my Ubuntu server as if it were a local folder:

Install the necessary libraries:
sudo aptitude install build-essential libcurl4-openssl-dev libxml2-dev libfuse-dev comerr-dev libfuse2 libidn11-dev libkadm55 libkrb5-dev libldap2-dev libselinux1-dev libsepol1-dev pkg-config fuse-utils sshfs

We also installed the sshfs (SSH File System) in order to test out FUSE. Go ahead and create a mount folder and mount a remote drive to it:
sudo mkdir -p /mnt/sshfs
sudo chown user:fuse /mnt/sshfs
sudo sshfs user@hostname:/path/on/remote/server /mnt/sshfs

You should now be able to browse files on /path/on/remote/server, locally from /mnt/sshfs. Please note that you will need to set the ownership of the mount before you’ll be able to use it. The fuse group was created automatically and is a good place to start.

To unmount the drive:
fusermount -u /mnt/sshfs

Download the s3fs source (Revision 177 as of this writing) from the Google Code project:
wget http://s3fs.googlecode.com/files/s3fs-r177-source.tar.gz

Untar and install the s3fs binary:
tar xzvf s3fs-r177-source.tar.gz
cd ./s3fs
sudo make
sudo make install

In order to use the allow_other option (see below) you will need to modify the fuse configuration:
sudo vi /etc/fuse.conf

And uncomment the following line in the conf file:
...
#user_allow_other

Now you can mount an S3 bucket like this:
sudo mkdir -p /mnt/s3
s3fs bucketname -o accessKeyId=XXX -o secretAccessKey=YYY -o use_cache=/tmp -o allow_other /mnt/s3

You will need to replace the XXX above with your real Amazon Access Key and YYY with your real Secret Key. I’ve also told it to cache the bucket’s files locally (in /tmp) and to Allow other users to be able to manipulate files in the mount. Check the wiki documentation for more options available to s3fs, including how to save your Access Key and Secret Key in /etc/passwd-s3fs.

Now any files written to /mnt/s3 will be replicated to your Amazon S3 bucket.

Installing ImageMagick and imagick via MacPorts

Installing ImageMagick with MacPorts couldn’t be easier:


sudo port install ImageMagick

But getting it to work with your PHP installation is a bit harder. If you’ve installed PHP via MacPorts with the pear variant you can install the imagick extension via pecl:


sudo pecl install imagick

The trick to getting it to stop complaining about the Wand-config path, is by passing it the proper prefix for ImageMagick. When prompted, hit 1, then enter in:

/opt/local

Now just add this to the end of your php.ini file, and reboot apache:


[imagemagick]
extension=imagick.so

Installing Sphinx on OS X for PHP

I’m starting to use sphinx in my work, and wanted to get a solid development environment set up for it on my local OS X server. Since I built my local server with Mac Ports, it was actually pretty easy to get that installed:

sudo port install sphinx

However, I had trouble setting up the PHP extension for the Sphinx API. I could have used the sphinxapi.php that ships with the sphinx source code, but having a compiled extension is faster, and I don’t have to add more files to my php project. Installing Sphinx via Mac Ports didn’t help either, because it doesn’t install libsphinxclient, which is required to build the PHP Extension. That was until I found some instructions from someone doing something similar for Ruby.

Continue reading ‘Installing Sphinx on OS X for PHP’

Redirect all traffic to a new site with Apache .htaccess

The easiest way to redirect all traffic from an old site to a new site is to use mod_rewrite with Apache in your .htaccess file. If this file does not already exist in the root of your site’s public folder, then go ahead and create it with a text editor. I suggest using vim.

Then pop this into it:

RewriteEngine On
RewriteRule (.*) http://new.example.com/$1 [L]

The above recipe has the added benefit of also appending the page the user was requesting to the end, so if the new site is a clone of the old site then this will ensure that your users get the page that they requested. There are easier ways to do this if you are just changing URLs out and the site will be on the same server, but this is the easiest way to redirect all traffic if the new site is on a different box all together.