I like to use macOS's alias feature to not have to make redundant files. These aliases work great with Chrome and TextEdit. When I open them with vim, however, I get a giant messy file (presumably the way macOS encodes aliases). Is there a way to edit the actual file through an alias with vim?
Asked
Active
Viewed 2,532 times
5
-
Just curious as to why you want to edit a macOS Alias file? – user3439894 Feb 05 '18 at 23:16
-
1I can't speak for the OP but I would like to do it in order to create a more complicated command with multiple arguments, something I can't directly create an alias for. The "select new original" button only seems to allow you to link to a single file, with no arguments or additional editing, which is what I need. – Tim Nov 12 '21 at 17:49
-
@Tim sounds like you expect something like Windows' aliases, but macOS' aliases do not allow to add arguments. You could think of them like Finder-level symlinks, from back in the 90s, when macOS' filesystem didn't allow real UNIX-type symlinks. – hmijail Feb 14 '24 at 07:38
1 Answers
-3
macOS aliases are just normal files. macOS knows when an alias is being accessed and passes the right file along to the app. Since aliases are just normal files, other tools just open the alias file itself rather than reading the contents of the file and finding where it points to.
If you actually want a link to another file, you can create a symbolic link instead of using aliases:

grg
- 201,078
-
-1. macOS aliases are NOT symlinks. Finder might present them the same to simplify, but they have different functionalities and scopes. A symlink works at the BSD layer (e.g. with Terminal programs), so it ALSO works on the GUI, but e.g. won't automatically mount a network drive. While a macOS alias only works in higher layers (like the GUI), not with e.g. Terminal programs; and can do things like cause network drives to mount. – hmijail Feb 14 '24 at 07:17
-
@hmijail I completely agree and that is exactly what my answer is saying. That is why I suggest creating a symlink instead of an alias. I've said aliases are normal files, with their own contents (data about the alias itself) not the contents of the file being aliased to. I'm not sure how your comment disagrees with my answer at all. – grg Feb 14 '24 at 07:24
-
OK, re-reading again I realize that you don't explicitly confuse them, just ... confusingly recommend using one when the OP asked about editing the other. – hmijail Feb 14 '24 at 07:33