U
U
Unicom2011-02-09 13:31:37
macOS
Unicom, 2011-02-09 13:31:37

How to make symlinks (symlink) in Mac OS X?

Continuing the topic of Chrome synchronization started in this question.
The situation is very strange: by making symlinks to files (Bookmarks, Cookies, Last Tabs) from the Dropbox folder and placing them in the Chrome profile, I was faced with the fact that Chrome simply replaced them with its own files (how much I understand symlinks, he was supposed to replace not them, but the files they refer to).
I'm confused, because Based on this, it turns out that symlinks can be safely made only on folders.
So the question is, am I doing something wrong, is Mac OS X doing something wrong, or is Chrome doing something wrong?
Yes, I make symlinks using this Applescript

on run <br/>
tell application &quot;Finder&quot; to set sel to selection <br/>
open sel <br/>
end run <br/>
on open the_files <br/>
repeat with i from 1 to (count the_files) <br/>
try <br/>
set posix_path to POSIX path of (item i of the_files as alias) <br/>
if posix_path ends with &quot;/&quot; then set posix_path to ¬ <br/>
text 1 thru -2 of posix_path <br/>
try <br/>
do shell script &quot;ln -s &quot; & quoted form of posix_path ¬ <br/>
& &quot; &quot; & quoted form of (posix_path & &quot;.sym&quot;) <br/>
on error <br/>
try <br/>
do shell script &quot;ln -s &quot; & quoted form of posix_path ¬ <br/>
& &quot; &quot; & quoted form of (posix_path & &quot;.sym&quot;) with administrator privileges <br/>
end try <br/>
end try <br/>
end try <br/>
end repeat <br/>
end open

UPD
Hardlinks also did not help, Chrome also overwrites them. The problem seems to be this - Chrome does not save to an existing file, it simply erases the old one and writes a new one in its place. This applies to at least two of the Bookmarks and Last Tabs files, because the Cookies file is synchronized using symlinks.
How to deal with this is not clear, because. you don’t need to synchronize the entire profile folder at all (and there are 2 files in it that are blocked while chrome is running, it turns out that the dropbox tries to read them all the time) ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
U
Unicom, 2011-02-09
@Unicom

It's true. Thanks, I'll try.
But still, it's very interesting why symlinks are replaced by chrome (I'm afraid that I just did something wrong)?

U
Unicom, 2011-02-09
@Unicom

In general, I did it in the console, put it in the same way and replaced them with chrome. Now I will make hardlinks.

P
Pavel Mir, 2014-07-29
@facetheheat

OS X has symlinks (posix), hardlinks (posix) and Finder Alias.
Applescript is a complete tin, who writes like that? :)
Try using Finder Alias ​​(right click on directory - Make Alias).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question