Last Updated: February 25, 2016
· webdevotion

Open the Xcworkspace file in the current directory


I often navigate my folders using the command line.

When I want to open a Xcode Workspace I type the following command:


The script ( aka 1 line of code )

Put this text in a new file workspace in your ~/bin folder.

It's possible you have to create that folder.

open -a "/Applications/Xcode.app" *.xcworkspace

Then run source ~/bin/workspace to start using the script immediately.

If you want to load the script every time your boot up your computer

add this line to your ~/.bash_profile:


This line will add your ~/bin folder to your $PATH
so it's always accessible from the command line.


Whenever you're in a folder containing a *.xcworkspace file

you just type workspace to open the current Workspace in Xcode.



When you have Developer Previews installed of Xcode,

make sure you have set the current stable version of Xcode

as the default application of *.xcworkspace.

Otherwise the latest ( and sometime not so greatest ) version of Xcode

will take over, which can be annoying when you are working on production apps.

The easiest way to do this is probably through Finder.

Say Thanks

1 Response
Add your response

Phillip profile image normal

I've got this working all the way down to the 'source ~/bin/workspace' command but have not gotten the 'workspace' command to work on it's own. (Command not found)

I did add 'PATH=$PATH:/Users/whoami/bin' to my ~/.bash_profile

Any idea where I could have gone wrong?

Thanks for writing this up

over 1 year ago ·
Awesome Job

Fa96d17e 2334 11e8 9ba7 5f2aa384a31c
Full-Stack Engineer
San Francisco (Remote)
Full Time