
You should generally use standard symbolic links (soft links), if you’re not sure which to use. So, if you created a hard link from /Users/example pointing to /opt/example and later moved /opt/example, the link at /Users/example would still point to the file, no matter where you moved it. However, if you create a hard link, it will actually point to the underlying inode on the file system. If you move the file at /opt/example, the link at /Users/example will be broken. For example, let’s say you have a symbolic-or soft-link from /Users/example pointing to /opt/example. A symbolic or soft link points to a path in the file system. In addition to symbolic links, which are sometimes called “soft links”, you can instead create “hard links”. If you browse to the /Library/Program directory in the Finder or any other application, it will appear to contain the files inside /Volumes/Program. Include the following in ~/.bash_profile or create a new file ~/.This is entirely transparent to the macOS operating system and the applications you use. #define CHECK(rc,check_value) if ((check_value) != noErr) exit((rc))įSResolveAliasFile( &fsRef, TRUE, &targetIsFolder, &wasAliased)) įSRefMakePath( &fsRef, targetPath, MAX_PATH_SIZE)) Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, License along with this program if not, write to the Free You should have received a copy of the GNU General Public General Public License for more details. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

WITHOUT ANY WARRANTY without even the implied warranty of This program is distributed in the hope that it will be useful, but License, or (at your option) any later version. published by the Free Software Foundation either version 2 of the modify it under the terms of the GNU General Public License as This program is free software you can redistribute it and/or warning: pointer targets in passing argument 1 of 'FSPathMakeRef' Note: gcc version 4 reports the following warning

gcc-3.3 -o getTrueName -framework Carbon getTrueName.c was an alias, or 1 if the argument given was not an alias The error number returned is 255 on error, 0 if the file name of the "Original" or actual file. Resolve HFS and HFS+ aliased files (and soft links), and return the You can add it to your PATH, or just copy it directly to /usr/bin or /usr/local/bin so it’s easy to access.Ĭ source code for getTrueName (copy the text and save the file as getTrueName.c in your home directory): // getTrueName.c

This will create the ‘getTrueName’ executable in the same directory as the source. To enable cd'ing into a folder alias I've found the following at Mac OS X Hints.Ĭompile the source code below with the following command: gcc -o getTrueName -framework Carbon getTrueName.c
