Installing SASS and Using SCSS Watcher for PHPStorm on OSX Yosemite

Standard

My OSX adventure continued today. I’d had no problems installing PHPStorm on my MacBook Air and after I installed Dropbox, all of my applications (hosted on Dropbox and created on a Windows machine) became available on my Mac.

I cloned a working project (Node.js and AngularJS) and wanted to modify it for a proof of concept application. The problem came when I had to modify the .scss  files in the project and have them watched so that they are recompiled whenever a change is made to any of them. PHPStorm’s SASS file watcher had worked brilliantly in my Windows environment but because I cloned an existing project, the settings for that project were also transferred to the new project (including the windows based file watchers).

Frustrated, I shutdown the laptop until I disembarked from the plane and fired it up again after two hours of waiting for my connecting flight. I scoured the web for a solution and while this question pointed me in the right way, my problem wasn’t solved.

I installed sass as the instructions on the website indicated but when I tried to test my installation using sass -v  , I got this error:

 Here’s how I solved the problem. Just two quick steps:

  • Install Rails. I did this using:  sudo gem install rails
  • Re-install Sass, using  sudo gem install sass

When I re-ran  sass -v , the output was correct.

I then restarted PHPStorm and tried to configure the SCSS File watcher and it worked like a breeze.

How to install MySQL and add it as a service on OSX Yosemite

Standard

As I mentioned in a previous post, I’ve just received a new Macbook Air and I continued setting up my development environment. After setting up Apache, I moved on to MySQL and I was a little bit disoriented.

This guide is a note to my future self on how I did it and also to others out there who may be on the verge of getting lost (or worse, frustrated).

I downloaded MySQL Server 5.6 (Community Version) from the MySQL website ( I needed to sign in with my Oracle ID ). After downloading, I ran the installer and MySQL was installed. The README suggests creating aliases for mysql  and mysqladmin . However there are other commands that are helpful such as mysqldump . Instead, I updated my path to include  /usr/local/mysql/bin

You will need to open a new Terminal  window or run the command above for your path to update.

You can start the server and confirm that your MySQL installation is working fine by running this:

But that’s not how you want to setup your database server, is it? Having to start and restart manually anytime you need the database server. You’d want to install it as a service that starts and stops when you startup and shutdown your Macbook.

To install as a service, you can follow this link. In case the information is no longer available, I’ve copied the information below:

OS X uses launch daemons to automatically start, stop, and manage processes and applications such as MySQL. Using launch daemons is recommended over startup items on OS X.

Note

OS X 10.4 deprecated startup items in favour of launchd daemons, and as of OS X 10.10 (Yosemite), startup items do not function. For these reasons, using launchd daemons is preferred over startup items.

Here is an example launchd file that starts MySQL:

Adjust the ProgramArguments array according to your system, as for example your path to mysqld  might be different. After making the proper adjustments, do the following:

  • Save the XML as a file named  /Library/LaunchDaemons/com.mysql.mysql.plist
  • Adjust the file permissions using the Apple recommended owner “root”, owning group “wheel”, and file permissions “644”
  • Enable this new MySQL service

The MySQL daemon is now running, and automatically starts when your system is rebooted.

This is the post that led me on the path to this solution.

How to open hidden folders on OSX finder

Standard

I got a new Macbook Air today and I’ve been setting it up as a development workstation. It’s pretty interesting stuff but also a bit frustrating. I was trying to setup Apache, MySql and PHP but I had issues opening files and folders that are hidden by default on OSX finder.

Luckily for me, I asked Google and I got help.

To open hidden folders such as /etc/apache2 in the Mac OS X Finder, do one of the following:

  • Press Shift + Cmd + G  and type  /etc/apache2
  • Open a Terminal window and type  open /etc/apache2

If you use your Mac as a development machine or just like tinkering around under the hood, you have no doubt been exposed to the folders that are normally hidden from view in the Finder. There are hacks that make the Finder show hidden files and folders, but if you want to keep your Finder windows clutter-free this is a nice way of accessing hidden folders when you need them.

Backup Stored Procedures only on MySQL

Standard

I’ve needed to do this a few times in the past and I still needed to do it again yesterday. Hence, I decided to put it here for reference processes.

 This would export just the stored procedures to the specified file ( sp.sql )