Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copying symbolic links in Mac OS X

Tags:

macos

What is the simplest way of copying symbolic links on the Mac?

A python or perl solution would be preferred, but any solution would be a help.

I am copying frameworks for an installation package, and need the links to be maintained

like image 572
David Sykes Avatar asked Oct 21 '08 09:10

David Sykes


People also ask

Can symbolic links be copied?

We can use the -l option of rsync for copying symlinks. rsync copies the symlinks in the source directory as symlinks to the destination directory using this option. Copying the symlinks is successful in this case.

How do I make a symbolic link Mac?

Find the file or folder you want to create a symlink for, right-click on it, and select Services followed by Make Symbolic Link. It'll create the symlink in the same folder as the original file/folder. You can move it around though if you want.

How do I create a hard link in Mac OS X?

Press Command+Space, type “Terminal”, and then press “Enter” to open Terminal from Spotlight search. Navigate to Finder > Applications > Utilities > Terminal to launch the Terminal shortcut. The -s here tells the ln command to create a symbolic link. If you want to create a hard link, you'd omit the -s .


1 Answers

As David mentioned, OS X is missing the handy -a option that gnu cp has.

However, if you use -R to do a recursive copy, then it will copy symlinks by default, so

cp -R source destination 

ought to work.

like image 187
Mark Baker Avatar answered Sep 22 '22 06:09

Mark Baker