Top osx Questions

List of Tags

With a huge influx of newbies to Xcode, I'm sure there are lots of Xcode tips and tricks to be shared.

What are yours?

Answered By: epatel ( 343)

Switch to Header/Source File

  • Option ⌥ Command ⌘ Up Arrow ↑

  • View > Switch to Header/Source File

Switches between the .m and .h files.

  • In Xcode 4 this is ctrl Command ⌘ Up Arrow ↑
svn, osx

On Windows, TortoiseSVN is the daddy, no question. On the Mac there is nothing as simple and integrated, but there is a fair choice of tools. Which GUI clients for Subversion (SVN) are worth checking out and why?

Answered By: Flubba ( 135)

Having been disappointed with all of them for one reason or another (mainly because they're horrible to use), I settled on the command line tools for ages. I was therefore delighted to find one that didn't make me want to stick pins in my eyes. Versions is a new SVN client now in Beta and is the first one to offer proper Mac OS X look and feel.

WARNING - Beta 5 converts your working copies to 1.5 format, and earlier versions of the SVN command line client tools cannot work with them after 1.5 has touched them. But it is easy to update the client tools to 1.5. As of 20080811, Beta 6 now supports both 1.4 and 1.5.

[I have no connection with the company or product.]

EDIT - Cornerstone does look good... I am happy with Versions for now, and will probably pay for it when it launches. The main loss for me is the built in diff-window in Cornerstone - that's nice - but the clunky management of working copies separately from repositories is something I found really bad with things like svnX and I think that's a clear win for Versions.

Diffing is so important that every developer should have a good tool. On Windows, we settled on the free WinMerge, but on the Mac I rely totally on the awesome and free TextWrangler; Versions automatically selected it to use for doing comparisons, so I am happy as a hog with them working together.

The Ohlhauser review is really useful - thanks for linking that. He's also posted a follow-up which is also worth reading.

I'm really glad there are now two really good tools available; SmartSVN, svnX and ZigVersion were all good efforts but all far short of the excellent standard set by TortoiseSVN on Windows.

UPDATE, JUNE 2011: Following the purchase of the Sofa team by Facebook, the future of VersionsApp is a little unclear. It will continue, but I'm not sure who will be maintaining it now. In other news, it still lacks built-in support for merging, still the biggest headache for many SVN users, I believe. But Cornerstone 2 supports merging and branching in the GUI now, so I am currently downloading that to evaluate it.

Which files should I include in .gitignore when using Git in conjunction with Xcode?

Answered By: Adam ( 129)

UPDATE 2013: the syntax for .gitignore is very hard to understand (badly implemented IMHO), and my last update didn't do as intended. I've updated it with something that APPEARS to do as intended

UPDATE: gist on github too, as requested:

I was previously using the top-voted answer, but it needs a bit of cleanup, so here it is re-done for Xcode 4, with some improvements.

I've also added some notes inline - I think it's risky to have files in a .gitignore if you don't explain why they're there :). Read the notes, if I've got anything wrong, please shout, and I'll re-research / modify / fix...

I've researched every file in this list, but several of them do not exist in Apple's official xcode docs (google couldn't find them, couldn't find them), so I had to go on mailing lists and heresay.

# .gitignore file for Xcode4 / OS X Source projects
# Version 2.0
# For latest version, see:
# 2013 updates:
# - fixed the broken "save personal Schemes"
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude

# OS X temporary files that should never be committed


# Xcode temporary files that should never be committed
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...


# Xcode build files -
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"


# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"


# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
# This is complicated:
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
#  saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
#  ..but if you're in the 1%, comment out the line "*.pbxuser"

#    NB: also, whitelist the default ones, some projects need to use these

# Xcode 4 - semi-personal settings
# OPTION 1: ---------------------------------
#     throw away ALL personal settings (including custom schemes!
#     - unless they are "shared")
# NB: this is exclusive with OPTION 2 below

# OPTION 2: ---------------------------------
#     get rid of ALL personal settings, but KEEP SOME OF THEM
#     - NB: you must manually uncomment the bits you want to keep
# NB: this is exclusive with OPTION 1 above

#     (requires option 2 above): Personal Schemes

# XCode 4 workspaces - more detailed
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
# Workspace layout is quite spammy. For reference:
# /(root)/
#   /(project-name).xcodeproj/
#     project.pbxproj
#     /project.xcworkspace/
#       contents.xcworkspacedata
#       /xcuserdata/
#         /(your name)/xcuserdatad/
#           UserInterfaceState.xcuserstate
#     /xcsshareddata/
#       /xcschemes/
#         (shared scheme name).xcscheme
#     /xcuserdata/
#       /(your name)/xcuserdatad/
#         (private scheme).xcscheme
#         xcschememanagement.plist

# Xcode 4 - Deprecated classes
# Allegedly, if you manually "deprecate" your classes, they get moved here.
# We're using source-control, so this is a "feature" that we do not want!


# Cocoapods:
# Ignoring these files means that whoever uses the code will first have to run:
# pod install
# in the App.xcodeproj directory.
# This ensures the latest dependencies are used.

# UNKNOWN: recommended by others, but I can't discover what these files are
# ...none. Everything is now explained.

What is the proper way to modify environment variables like PATH in OS X? I've looked on google a little bit and found 3 different files to edit:

  • /etc/paths
  • ~/.profile
  • ~/.tcshrc

I don't even have some of these, and I'm pretty sure that .tcshrc is wrong, since osx uses bash now. Anybody have any idea where these variables, especially PATH, are defined?

Edit: I'm running OS X 10.5

Answered By: Matthew McCullough ( 229)

Bruno is right on track. I've done extensive research and if you want to set variables that are available in all GUI apps, your only option is /etc/launchd.conf

Please note that environment.plist does not work for applications launched via Spotlight. This is documented by Steve Sexton here.

1) Open a terminal prompt

2) Type sudo vi /etc/launchd.conf (note: this file might not yet exist)

3) Put contents like the following into the file

# Set environment variables here so they are available globally to all apps
# (and Terminal), including those launched via Spotlight.
# After editing this file run the following command from the terminal to update 
# environment variables globally without needing to reboot.
# NOTE: You will still need to restart the relevant application (including 
# Terminal) to pick up the changes!
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
# See
# and
# Note that you must hardcode the paths below, don't use enviroment variables.
# You also need to surround multiple values in quotes, see MAVEN_OPTS example below.
setenv JAVA_VERSION 1.6
setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
setenv GROOVY_HOME /Applications/Dev/groovy
setenv GRAILS_HOME /Applications/Dev/grails
setenv NEXUS_HOME /Applications/Dev/nexus/nexus-webapp
setenv JRUBY_HOME /Applications/Dev/jruby

setenv ANT_HOME /Applications/Dev/apache-ant
setenv ANT_OPTS -Xmx512M

setenv MAVEN_OPTS "-Xmx1024M -XX:MaxPermSize=512m"
setenv M2_HOME /Applications/Dev/apache-maven

setenv JMETER_HOME /Applications/Dev/jakarta-jmeter

4) Save your changes in VI and reboot your Mac. Or use the grep/xargs command show in the code comment above.

5) Prove that your variables are working by opening a Terminal window and typing export and you should see your new variables. These will also be available in IntelliJ and other GUI apps you launch via Spotlight.

Abdullah Jibaly

Is there something similar to the "Open Command Window Here" Windows Powertoy for Mac OS? I've found a couple plugins through a google search but wanted to see what works best for developers out there.

Answered By: Chris Page ( 304)

As of Mac OS X Lion 10.7, Terminal includes exactly this functionality as a Service. As with most Services, these are disabled by default, so you'll need to enable this to make it appear in the Services menu.

System Preferences > Keyboard > Keyboard Shortcuts > Services

Enable New Terminal at Folder. There's also New Terminal Tab at Folder, which will create a tab in the frontmost Terminal window (if any, else it will create a new window). These Services work in all applications, not just Finder, and they operate on folders as well as absolute pathnames selected in text.

You can even assign command keys to them.

Services appear in the Services submenu of each application menu, and within the contextual menu (Control-Click or Right-Click on a folder or pathname).

In addition, Lion Terminal will open a new terminal window if you drag a folder (or pathname) onto the Terminal application icon, and you can also drag to the tab bar of an existing window to create a new tab.

Finally, if you drag a folder or pathname onto a tab (in the tab bar) and the foreground process is the shell, it will automatically execute a "cd" command. (Dragging into the terminal view within the tab merely inserts the pathname on its own, as in older versions of Terminal.)

You can also do this from the command line or a shell script:

open -a Terminal /path/to/folder

This is the command-line equivalent of dragging a folder/pathname onto the Terminal application icon.

On a related note, Lion Terminal also has new Services for looking up man pages: Open man page in Terminal displays the selected man page topic in a new terminal window, and Search man Pages in Terminal performs "apropos" on the selected text. The former also understands man page references ("open(2)"), man page command line arguments ("2 open") and man page URLs ("x-man-page://2/open").


I know the combination Ctrl+A to jump to the beginning of the current command, and Ctrl+E to jump to the end.

But is there any way to jump word by word, like Alt+/ in Cocoa applications does?

Answered By: Kristian J. ( 100)

Out of the box you can use the quite bizarre Esc+F to move to the beginning of the next word and Esc+B to move to the beginning of the current word.

John Topley

How can I remove those annoying Mac OS X .DS_Store files from a Git repository?

Answered By: benzado ( 234)

Remove existing files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch

Add the line


to the file .gitignore, which can be found at the top level of your repository (or created if it isn't there already). Then

git add .gitignore
git commit -m '.DS_Store banished!'