Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does @require always give me the error "couldn't load @require from forbidden URL" for local scripts on Greasemonkey/Tampermonkey on MacOS

I like to keep my personal userscripts on local storage that syncs to the cloud. What I have been doing in the past is simply backing them up but then I realized I can use the @require tag to link to my local version of the file which I can then edit in my IDE.

This worked for a while but stopped working for some reason about 2 years ago and I would like to solve this issue as I am using userscripts more and more these days.

I'm using Google Chrome, Tampermonkey and MacOS.

Here is an example of my userscript code. Please be advised that I'm certain the path is correct.

// ==UserScript==
// @name         Google Mods
// @run-at       document-start
// @namespace    http://google.com/
// @version      1.00
// @description  Google mods
// @author       John Doe
// @match        https://*.google.com/*
// @require      file://⁨/Users/johndoe/Desktop/google.user.js
// ==/UserScript==

When I look at the console when viewing the page I can tell that it is attempting to load the script but cannot find it. This is what the error looks like

Tampermonkey: couldn't load @require from forbidden URL file://⁨/Users/johndoe/Desktop/google.user.js

Any help as to what I am missing would be greatly appreciated.

EDIT: To be clear I have the extension setting Allow access to file URLs enabled.

like image 499
Michael Avatar asked Feb 02 '26 03:02

Michael


1 Answers

  1. Type in the chrome search bar: chrome://extensions.
  2. Then search for: Tampermonkey.
  3. When you find the tampermonkey extension click on details.
  4. Navigate almost to the end and enable the option: allow access to file urls.

I hope it helps, greetings

search tampermonkey enable the option to allow URLs

like image 78
Andy Luis Avatar answered Feb 03 '26 23:02

Andy Luis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!