I am creating a zip file and would like to include a link to a website within it so that users can double-click on the file and go straight to the website. In my research, I discovered that what I want is a .url file because it is cross-platform.

However, I can't seem to create one on a Mac. Whenever I drag a URL to my desktop, a .webloc file is created instead. This file is typically associated with Safari and isn't readable on Windows, so it won't work. Unfortunately, it's created even if I drag the URL from an alternative web browser, like Firefox.

According to this page, there is some non-trivial data within a .url file that makes it so that I can't just create one myself in a text editor without knowing what I'm doing. So how can I create a .url file on a Mac?


Add these lines in TextEdit and save as .Url

  • 7
    I don't think the IconIndex is necessary.
    – hectorpal
    Jun 23 '16 at 13:06
  • 1
    It's up to you to give Icon for the shortcut. So why not?
    – Kirk
    Jul 31 '17 at 5:29
  • 6
    "It's up to you implies" it's not necessary.
    – hectorpal
    Aug 6 '17 at 23:27
  • 1
    Beautiful solution. I tried with and without the index thing, and it uses the compass-looking icon, labeled URL for both. Both also worked.
    – VISQL
    Jul 23 '19 at 10:57

Following Kirk's answer, here is an small bash script for creating such files. Executing

url-create.sh superuser-site http://superuser.com/

creates a file superuser-site.url:


The url-create.sh shell script is the following:

if [[ $# -le 1 || $# -ge 3 ]] ; then
    echo Usage: $0 '<namefile> <url>'
    echo Creates '<namefile>.url'.
    echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
    exit 1

echo '[InternetShortcut]' > "$file"
echo -n 'URL=' >> "$file"
echo $url >> "$file"
#echo 'IconIndex=0' >> "$file"

PS: I don't think the IconIndex is necessary, so I commented it out.


On mac, without [InternetShortcut] it always opens in Safari, while including it makes the file open with the default browser.


It is sufficient to put


in the file to make it work, the [InternetShortcut] and IconIndex seem not to be necessary (any more?).

  • 3
    in my case had to use [InternetShortcut] otherwise it wasn't working
    – SeanClt
    Apr 9 '20 at 19:58

In my case, without [InternetShortcut], Safari is pulled up, but no webpage is opened. With [InternetShortcut], it opens with the default browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.