Launch apps for work in OSX Command line

By Tom Fri, 02/19/2016 - 23:53

We’re going to show how to launch any graphical Mac app from the command line of OS X, including how to open specific files from the command line with a GUI app, and how to edit and open those files with root access if it’s necessary. For example this will open all apps for your work

  • MYSQL
  • PHP Storm
  • Skype
  • Slack

Step 1: Create shell file

Create a file /usr/local/bin/work with code at the bellow: sudo nano /usr/local/bin/work

#!/bin/bash

echo -e "Killing Mysql Server pid."
sudo pkill mysqld
sudo /usr/local/mysql/support-files/mysql.server start
echo -e "Opening PhpStorm"
open /Applications/PhpStorm.app
echo -e "Opening Skype"
open /Applications/Skype.app
echo -e "Opening Slack"
open /Applications/Slack.app

Step 2: Set file able to excecute

sudo chmod +x /usr/local/bin/work

You're done

now enjoy by open terminal and type this command: work