• Skip to main content
  • Skip to primary sidebar

Founder at work

Master the skills to create and launch your next SaaS company

  • About Me
  • Reviews
  • Resources
  • Community
  • Contact
  • Lessons
  • Series
  • Search
  • Login

Introduction to automation using OSX

January 28, 2016 by Rick Hernandez Leave a Comment

OSX Automation


In this section you will find some automation tips and tricks that you can use for your workflow in order to make you a more productive programmer.

Virtual Box and Samba Shares

If you are running a VirtualBox instance from the GUI, and then mounting the samba share. This is costing you time and effort. Automate this with a simple command to startup your workflow and stop your workflow.

First you need to create an alias to startup the virtual machine. Before you run the following command on the terminal make sure that you change the value of <VMNAME> to the name of the VM that you want to startup.

echo "alias  vmwww='VBoxManage startvm \"<VMNAME>\" --type headless'" >> ~/.bash_profile

Now that you can startup the VM you will need a way to mount a samba share and SSH into the server. Change the <USERNAME> value to reflect your username, change <DOMAIN OR IP ADDRESS> to match your domain or ip address, then open your terminal and run the following command. This command will create an alias for www which will create a directory named www and mount your samba shares to it, then SSH you into the virtual machine.

echo "alias www='mkdir ~/Desktop/www && mount_smbfs //<USERNAME>@<DOMAIN OR IP ADDRESS>/www ~/Desktop/www && ssh <USERNAME>@<DOMAIN OR IP ADDRESS>'" >> ~/.bash_profile

Neat! The last part is to be able to turn off the machine, you can do this by creating another alias that un mounts the samba share, deletes the directory, and powers off the virtual machine. First edit the values to reflect your setup and then run this command.

echo "alias uwww='umount ~/Desktop/www && rm -R ~/Desktop/www && VBoxManage controlvm \'<VMNAME>
\' poweroff" >> ~/.bash_profile

Don’t forget to tell bash about the changes.

source ~/.bash_profile

At this point you will have the following commands available to you.
* vmwww starts VM
* www mounts shares and SSH’s into VM
* uwww unmounts samba share and powers off VM

Terminal Aliases

The following alias improves the standard ls command by displaying all files included hidden files, in a long listing format that is human readable with ignored groups.

echo "alias ll='ls -lahG'" >> ~/.bash_profile

Don’t forget to tell bash about the changes.

source ~/.bash_profile

hello

Rick Hernandez

I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: JSecademy

Primary Sidebar

Learn How To Take Your Idea And Convert It Into An App From Scratch Even If You Have Never Written A Single Line Of Code.

  • How to Find Your Next Great App Idea
  • The Secret To Getting PAID To Build Your Own App
  • How To Create Your App (SaaS, Mobile, VR, AR, Game)
  • How To Monetize Your Apps
Learn More
4.82 Ratings

Copyright © 2025 · JSecademy Blog Theme on Genesis Framework · WordPress · Log in