MacOS alias compatible with Linux?

I use my computer as a PVR using EyeTV to record and a Kodi for playback. To do this I need to make aliases of the recordings with different file names so Kodi can scrape the metadata. This works fine when I use the same computer to watch the shows. What I would like to do is run Kodi on a Raspberry Pi running Linux. When I do this the Pi sees the aliases but cannot follow them to the .mpg file. What can be done to get a non-MacOS system to follow a Mac alias? Also the .mpg file is in a package if that matters.

Mac Pro, macOS 10.14

Posted on Jun 21, 2020 3:22 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 22, 2020 3:18 PM

Lets be clear in our terminology. A macOS Alias is a file that works with the Finder and GUI applications that call the GUI File Manager Framework.


A symbolic link is a low level file system abstraction that all programs and files can see and use.


When dealing with access the Mac from a remote system and having symlinks, it is important that the symlink path be a path that is visible to the remote system, as many times their view of the world starts from the mount point down.


That is to say if you export /Users/your_username/subdirectory/sub/sub/THIS_DIRECTORY

The remote system can only see things from THIS_DIRECTORY down.


So, if your symbolic link path includes things like /Users/your_username/etc... the remote system cannot see them because they were not exported as part of the mount point.


In that case, you need to use relative paths


Symlink to file in same directory to create a different name

ln -s original_name alternate_name

Symlink to file that is one directory up and then down a directory would be

ln -s ../down1/down2/original_name alternate_name

Need to go up 2 directories and then down

ln -s ../../down/original_name alternate_name


In all of these examples, I have ASSUMED that you are issuing the command from the directory where the alternate_name is located.


If that is not the case, you will need to specify a longer path.


But in all cases the relative path to the original_name MUST assume it is starting from the directory where the alternate_name is located.

Similar questions

11 replies
Question marked as Top-ranking reply

Jun 22, 2020 3:18 PM in response to TryAgain12

Lets be clear in our terminology. A macOS Alias is a file that works with the Finder and GUI applications that call the GUI File Manager Framework.


A symbolic link is a low level file system abstraction that all programs and files can see and use.


When dealing with access the Mac from a remote system and having symlinks, it is important that the symlink path be a path that is visible to the remote system, as many times their view of the world starts from the mount point down.


That is to say if you export /Users/your_username/subdirectory/sub/sub/THIS_DIRECTORY

The remote system can only see things from THIS_DIRECTORY down.


So, if your symbolic link path includes things like /Users/your_username/etc... the remote system cannot see them because they were not exported as part of the mount point.


In that case, you need to use relative paths


Symlink to file in same directory to create a different name

ln -s original_name alternate_name

Symlink to file that is one directory up and then down a directory would be

ln -s ../down1/down2/original_name alternate_name

Need to go up 2 directories and then down

ln -s ../../down/original_name alternate_name


In all of these examples, I have ASSUMED that you are issuing the command from the directory where the alternate_name is located.


If that is not the case, you will need to specify a longer path.


But in all cases the relative path to the original_name MUST assume it is starting from the directory where the alternate_name is located.

Jul 1, 2020 8:18 AM in response to BobHarris

I understand to pros and cons of the different links. I was able to recode my scripts to either do hard links or relative symlink. What really ended up being the problem was the program I was using to read those links. Kodi 18.2 on both linux and android both try to scrape the original file name instead of using the file name of the link. So they would work with a hard link but not either of the symlinks. I have never upgraded Kodi to 18.2 on my Mac so I don't know if that would be a problem there also. My fix was to down grade back to 15.2 like I have on my Mac and all works well. Even though the absolute symlinks are on a shared volume Kodi can follow them. In contrast the linux desktop can only follow the relative symlinks not the absolute symlinks. This process was frustrating but I learned more so all is good.

Jun 26, 2020 1:36 PM in response to TryAgain12

Hardlinks just create multiple directory entries to the same file. You can delete any of the directory entries and the file will continue to exist as long as there is one hardlink pointing at the file.


Hardlinks have the restriction that they must exist in the same file system, and will not work when the directories are on 2 different disks, volumes, partitions, etc...


Symbolic links, since they just contain a path, can cross mounted file systems, and even include NFS remote mounted files systems (if automount is setup correctly). But if the original file is deleted, the symbolic link will not save the file, and the symbolic link will just be a dead link to a non-existent file.


On macOS these are low level file system constructions and, when properly created, work for any GUI application, Unix program, launch agent or daemon, etc...


macOS Aliases are a GUI level abstraction and as such do not work for Unix commands and programs, launch agents and daemon, etc...

Jun 26, 2020 5:44 AM in response to TryAgain12

After doing a little more research it looks like I am using absolute symlinks and I need to use relative symlinks. I have also looked into using hardlinks. For some reason my script is doing other weird things when I try these other two links so more investigation is needed. At least now I understand why things were not working and have an idea how to fix the problem.

Jun 24, 2020 2:44 PM in response to BobHarris

So this sounds like it is possible to do. It sounds like I need to mount the whole volume on my remote system then point Kodi, the application I want to find these files, to the folder containing the symlinks in the mounted shared volume. I think previously I either pointed Kodi to the network path to the symlink folder or the mounted symlink folder.


Also you can see below how I have generated the symlinks. I don't think my symlinks look exactly like you suggested. Are they doing what what they need to do? I am assuming since Kodi could find the episodes when pointed to the Tv DB folder that it could handle the spaces in the path names. If spaces in the paths are going to be a problem then I need to do some more coding.


Set Fpath to container of (thisLocation as alias) as alias --thisLocation is the location of the recording returned from the application  EyeTV
Set mpgname to the quoted form of the POSIX path of Fpath & "/*.mpg" --this gives path to the mpg file in the recording container


Then I work on the symlink name


set symlink to Martha:TV DB:Blue Bloods:Season 10:EpisodeName
set symlink to the quoted form of the POSIX path of symlink
do shell script "ln -s" & space & mpgname & space & symlink


The original file is located in Martha/EyeTV Archive

The symlink is in Martha/TV DB/Show Name/Season #/Episode Name

Martha is the name of the volume in which these folders exist.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MacOS alias compatible with Linux?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.