In terminal:
nano ~/.bash_profile
Place the following in the opened file:
# Open Xcode workspace from terminal.
alias workspace='open -a "/Applications/Xcode.app" *.xcworkspace'
alias project='open -a "/Applications/Xcode.app" *.xcodeproj'
Control X
to close the file and Y
to save it. Then press Enter
.
Quit the Terminal and relaunch it for the changes to take effect.
- Inside a directory with a
.xcworkspace
file use the commandworkspace
to open Xcode. - Inside a directory with a
.xcodeproj
file use the commandproject
to open Xcode.