Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Spectrum

macrumors 68000
Original poster
Mar 23, 2005
1,810
1,117
Never quite sure
I'd like to create/copy local hyperlinks to local files and/or folders, so that the clickable text directly takes me to that file/folder on my local system.

How can I do that on macOS?
 
I don't know the context of your hyperlinks, but wouldn't a URL like this work?

file://localhost/path/to/filename
or
file:///path/to/filename
 
  • Like
Reactions: Spectrum
Thanks both. I can copy (and paste) the pathname, but how would I paste that into say, a document or notes app, to generate a clickable link to the file/folder?
 
I don't know the context of your hyperlinks, but wouldn't a URL like this work?

file://localhost/path/to/filename
or
file:///path/to/filename
EDIT: OK, so if I add the file::///stuff, I think it works, but the App in question complains:
1678399656727.png
 
Does this happen only when the file is in "Dropbox", and not when it's in Documents?

This looks like one of the privacy controls added to recent versions of macOS. Basically, applications need special permission to access any unusual place or resource. Probably "Microsoft To Do" is allowed to access files within your Documents folder, but probably is not allowed access elsewhere in the filesystem.

I'm assuming the error message is referring to a folder for Dropbox.com's file syncing. The problem might be that it isn't within Documents -- I seem to remember that by default the Dropbox folder is placed directly within your "Home" folder instead.

If I'm right about all this, you could choose to give permission to the "Microsoft To Do" app to access all files on the disk by giving the app permission for "Full Disk Access", and that should eliminate the error you've shown.

Only do this if you trust the app to not snoop in your contacts, photos, movies, or anywhere else on the disk!

What macOS are you running? I'm still on Monterey, and the setting to give access is found within:
System Preferences-->Security & Privacy-->Privacy tab-->Full Disk Access (on the left)--> "+" on the right to add an application.

However, I know that in the latest OS (Ventura) they renamed System Preferences to be System Settings, and re-arranged some things...
 
  • Like
Reactions: Spectrum
I'm on Catalina. I tried adding Full Disk Access in preferences, but it still throws the error.

I also tried file:///Users/NAME/Documents
No joy.

EDIT: At the moment, the best I can do is create "online" links to Dropbox, such that folders/files I want to link to open up on the Dropbox browser. But this is a crazy way to go about things when all the files/folders are present on my local machine...
 
I think you're trying to use particular apps to do something that they're really not set up to do.…and I get it.

However, you might need to think about some other method (third-party app) to achieve your goal.
 
I think you're trying to use particular apps to do something that they're really not set up to do.…and I get it.

However, you might need to think about some other method (third-party app) to achieve your goal.
Possibly...but the To Do app, has a free-text box associated with each task. I'd simply like to add local hyperlinks to relevant documents/folders associated with each task. As I said, I can add a hyperlink to a website (such as a Dropbox repository) there fine and the link is clickable and works (launching Safari). But links to local folders appear to be blocked due to permissions...a rather frustrating (and unnecessary) limitation!

Q: Is there a way/format to make the path launch Safari, and then safari open the local link? (Automatically) I could live with that as a workaround...

Safari opens the links fine when they are pasted into the address bar for example...so I just need a way of fooling the To Do app so that it sends the Hyperlink to Safari (which then opens the local file).
 
Last edited:
Totally wild grasp at straws here, but might be a number of things going on.

As @BrianBaughn mentioned, app might be not really setup to do that. It's a cloud-y application, so a link to a local file makes little sense if using the app on a mobile device or different computer via browser.

Another thing is that Dropbox has been moving their user's file stores to use Apple CloudKit framework. I have not dug deep into what one can/can't do when the files are there, but it does mess up things that might have worked in the past. For example, I had a login LaunchAgent to clean out old backups I made and stored in Dropbox, and once the Dropbox folder was moved under CloudKit, permission problems started to pop-up.

Catalina supports CloudKit and what might be happening in the case of Dropbox cannot be seen by MS To Do:

CloudKit is designed for manageability, flexibility, and power. By organizing apps in containers, CloudKit ensures each app is siloed so its data won’t get entangled with other apps.

If the Dropbox folder is under CloudKit, can maybe try a more fully qualified pathname, but guessing that might not work either due to above. So, /Users/id/Library/CloudStorage/Dropbox/myfilename.doc
 
Totally wild grasp at straws here, but might be a number of things going on.

As @BrianBaughn mentioned, app might be not really setup to do that. It's a cloud-y application, so a link to a local file makes little sense if using the app on a mobile device or different computer via browser.

Another thing is that Dropbox has been moving their user's file stores to use Apple CloudKit framework. I have not dug deep into what one can/can't do when the files are there, but it does mess up things that might have worked in the past. For example, I had a login LaunchAgent to clean out old backups I made and stored in Dropbox, and once the Dropbox folder was moved under CloudKit, permission problems started to pop-up.

Catalina supports CloudKit and what might be happening in the case of Dropbox cannot be seen by MS To Do:



If the Dropbox folder is under CloudKit, can maybe try a more fully qualified pathname, but guessing that might not work either due to above. So, /Users/id/Library/CloudStorage/Dropbox/myfilename.doc
Thanks for the ideas!

I don't think it has anythign to do with Dropbox/cloudkit because the I can't make links to any local files—not even to just the route of my home folder, or Documents ot Desktop etc.

I agree it is possible that To Do considers local links pointless...but that ignore the fact that so many of us use a synchronised local file structure these days. (via DropBox, OneDrive, GoogleDrive, iCloud, etc).

I really don't want to actually attach the files to the ToDo app. It just isn't the right option for a To Do app where the tasks are inherently short-lived. All I need is links to folders with the information relevant to the task.

DropBox links to folders work...but are slower and pointless when the local folder/file itself exists on the machine. There is absolutely no reason to interact with those files via an online browser.

1678552808066.png
 
From "Microsoft To Do" open any file on the desktop (File - open or whatever the menu is). That should give it the necessary permission.
 
I don't have Microsoft To Do, my suggestion is based on Apple's documentation:
"The user implicitly grants your app access to a file in the Desktop folder when selecting the file in an Open or Save panel, dragging it onto your app, or opening it in Finder. Your app can access that file right away and any time in the future. In addition, if your app creates a new file in the Desktop folder, the app can access that file without user consent."
https://developer.apple.com/documen...property_list/nsdesktopfolderusagedescription
 
  • Like
Reactions: Spectrum
I don't have Microsoft To Do, my suggestion is based on Apple's documentation:
"The user implicitly grants your app access to a file in the Desktop folder when selecting the file in an Open or Save panel, dragging it onto your app, or opening it in Finder. Your app can access that file right away and any time in the future. In addition, if your app creates a new file in the Desktop folder, the app can access that file without user consent."
https://developer.apple.com/documen...property_list/nsdesktopfolderusagedescription
Yeah - many thanks for the idea. I wish it worked this way...

Regrettably, attaching files to ToDo itself—even though they then sync within the app—isn't really a great solution because it is unclear to me what will happen when tasks get ticked off. I'd then have to manually export them back to where I need to file them prior to completing the task...which just feels annoying. Not to mention the fact that it will lead to duplicates etc...
 
I was not suggesting to add attachments, just Apple’s ways of granting permission for the Desktop folder.

But macOS permissions are a mess. If you add the file as attachment and remove it, the link for the file works...until you close Microsoft To Do.

I have SIP disabled and I granted Microsoft To Do permission for the Desktop folder. The link still doesn’t work.
Video:
 
  • Like
Reactions: Spectrum
I was not suggesting to add attachments, just Apple’s ways of granting permission for the Desktop folder.

But macOS permissions are a mess. If you add the file as attachment and remove it, the link for the file works...until you close Microsoft To Do.

I have SIP disabled and I granted Microsoft To Do permission for the Desktop folder. The link still doesn’t work.
Video:
View attachment 2172585
Thanks for investigating. I Attaching is a fall-back option - and the one that ToDo seems to want you to do...but I've realised that editing an attached file only modifies the local attachment, not the one synced via ToDo itself. So, again, this is pointless.

Unless someone knows of a way of creating a hyperlink to Safari that then opens the local file...it looks like I am out of luck and either need a different software Task list program (although, other than this, I really like ToDo's simplicity), or will have to live with DropBox web links instead. Not ideal though...because I can't even see how to open the local file form there...something that I am sure used to be possible...
 
Not ideal, but here is a solution:
Automator – New – Quick Action – Workflow receives current – text in Microsoft To Do
In the left Library search for Run Shell Script and drag it into the workflow, choose Pass input as arguments, instead of echo, write open. Save and close, go to System Settings – Keyboard – Shortcuts – Services – in the Text section you will find the created Quick Action and you can assign a shortcut, like ⌘⇧O.
Now, when you select the text /Users/user/Desktop/TextFile.txt in Microsoft To Do, you can press the shortcut and the file will open.

OpenMTD.png
 
Not ideal, but here is a solution:
Automator – New – Quick Action – Workflow receives current – text in Microsoft To Do
In the left Library search for Run Shell Script and drag it into the workflow, choose Pass input as arguments, instead of echo, write open. Save and close, go to System Settings – Keyboard – Shortcuts – Services – in the Text section you will find the created Quick Action and you can assign a shortcut, like ⌘⇧O.
Now, when you select the text /Users/user/Desktop/TextFile.txt in Microsoft To Do, you can press the shortcut and the file will open.

View attachment 2172858
Fantastic! It works! I also added a hotkey:
1678791579068.png

Question: Is there a way to replace /Users/User/Dropbox... with ~/Dropbox... so that this works on Dropbox-synced computers that (regrettably) have different user names, but the same file structure?

Edit: Actually it looks like I can delete "Users/User/" part and the local file/folder opens fine, so I could either delete that from the pathname upon pasting (slightly annoying...), or modify the shell script to ignore/delete the first two parameters.
 
Last edited:
EDIT: weird..the service has stopped working...

Scratch that...it is a problem if there is trailing whitespace that get's highlighted in ToDo when triple clicking the filepath. Any workaround? :)
 
Have you tried with a ~/ link and it doesn’t work?
I’m on another Mac now and I can’t test it.
You can also create a service to copy the path of a file into clipboard.
Something like this AppleScript:
Code:
tell application "Finder"
    set theLink to POSIX path of (selection as string)
    set the clipboard to theLink
end tell
 
"Open Finder Items" Automator action can open both ~/Desktop/Text file.txt and /Users/user/Desktop/Text file.txt

Open Finder Items.jpg
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.