Brian Gesiak
Brian Gesiak

Reputation: 6958

Is there a way to share code snippets among several installations of Xcode?

Based in part on the advice in this response to a question on SO, I tried replacing /Developer/Library/Xcode/PrivatePlugIns/IDECodeSnippetLibrary.ideplugin with an alias to an exact copy in a Dropbox folder, but doing so caused Xcode 4.2 to crash due to an internal logic error.

I want to sync the snippets on my work and home machine. Right now I'm using Alfred for snippets, but it'd be nice to have Xcode handle the snippets, for convenient tab jumping and intellisense. Has anyone out there attempted something similar?

Upvotes: 8

Views: 4216

Answers (2)

utkal patel
utkal patel

Reputation: 1421

as i do and it work.

simply copy your code snippets in

~/Library/Developer/Xcode/UserData/CodeSnippets/

if your didn't made any custom code snippets before then you have to copy whole 'CodeSnippets' dir to path

~/Library/Developer/Xcode/UserData/

now simply close the xcode from activity monitor and start it again you will get new code snippets.

/ use the following code to show hidden file / apply this command one by one in teminal

defaults write com.apple.Finder AppleShowAllFiles TRUE

killall Finder

Upvotes: 2

djromero
djromero

Reputation: 19641

I guess sharing your own (not the system) snippets is fine. Then, try replacing ~/Library/Developer/Xcode/UserData/CodeSnippets with a symbolic link to your shared folder.

Something like: (in Terminal app)

cd ~/Library/Developer/Xcode/UserData
mv CodeSnippets /path/to/shared/folder/
ln -s /path/to/shared/folder/CodeSnippets CodeSnippets

Repeat in any Mac in which you want to access shared snippets.

Upvotes: 17

Related Questions