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

walterpaisley

macrumors 6502
Original poster
Oct 27, 2004
361
363
Springfield
A huge YMMV here - a lot of the more complex extensions need to be updated to work with Safari, but straight-forward extensions generally work. I am most definitely not a developer so please do not expect expert troubleshooting help from me. If you run into an issue I might be able to help, but I have a tiny developer brain. It's not good for much.

With that out of the way, let's go!
  1. First, you need to be on Big Sur with the latest Xcode (12) installed. But! There's a big asterisk to this which I'll get to later.
  2. The way I've done this is to make sure the extension I want to convert is installed in Chrome first. Open Chrome's Extensions screen and find the extension you want to convert.
  3. Look for the extension ID, which is a long string of numbers and letters. Copy that and paste it somewhere handy.
  4. Find the path to your Chrome extensions folder. This depends on which build channel you're using (release, dev, canary). I run Canary so my extensions folder is
    Bash:
    /Users/[me]/Library/Application Suport/Google/Chrome Canary/Default/Extensions/
  5. Launch the terminal and run the command to convert the Chrome extension into an Xcode format:
    Bash:
    xcrun safari-web-extension-converter /big/ass/path/to/chrome/extensions/from/above/{EXTENSION ID}/{some version number}
    and hit return
  6. Double-check the settings xcrun returns.
    1. Xcode project location is where xcrun will save the converted extension
    2. Leave all of the other settings at default (although you can change the app name and app bundle ID if you really want to). Leave the language set to Swift.
  7. After xcrun is done, Xcode will launch with the extension loaded as a new project. You will probably need to change the code signing settings (found under Signing & Capabilities). I've only ever built these code signed to my existing developer account. You might be able to set this to "None" and "Sign to run locally" but caveat nerd - troubleshooting code signing issues are not my strong point.
    CleanShot 2020-07-22 at 18.57.56@2x.png
  8. Make sure you set both Targets to the same signing settings.
  9. Go to the Product menu > Build for and select Running. The other settings might work as well, but this is what I've always done
  10. The build should be "Successful". This is where you drink.
  11. Now launch Safari and look under the Extensions preferences - you should see the new extension there, waiting to be checked off and activated.
  12. If you built your extension unsigned (or signed locally), you'll need to turn on the Develop menu (Preferences > Advanced > Show Develop menu in menu bar) and enable Allow Unsigned Extensions before you can turn on your extension.
I've successfully converted extensions like Refind, Notion, DF Tube, the 33Msil extension, and a couple of others. From what I can tell extensions that change the page layout somehow or grab URLs work.

Big asterisk: From the limited testing I've done you can't convert extensions on Catalina with Xcode 12 installed BUT you can build them. What I've done is converted the extensions on my macOS 11 machine and then copied them over to my Catalina machine and built there. These extensions will run in the Safari 14 beta for Catalina.

I hope this is useful for y'all. If you successfully build and run other extensions, please post your success here for others.
 
Last edited:
  • Like
Reactions: M3Evo and winmaciek

markosb

macrumors 6502
Mar 19, 2010
384
55
For some reason it's not opening Xcode, I get a list of options... and the prompt.

Options:


--project-location The location to put the created Xcode project.


--app-name The name of the generated app.


--bundle-identifier The bundle identifier for the generated app.


--swift Use Swift in the generated app.


--objc Use Objective-C in the generated app.





Additional flags:


--copy-resources Copy the extension files to the generated project. If not specified, the project will reference the original extension files.


--no-open Do not open the generated Xcode project when complete.


--force Force overwriting the output directory if it exists.


--help Print this help text.
 
  • Like
Reactions: indra05d

markosb

macrumors 6502
Mar 19, 2010
384
55
A couple of added notes. I had to copy the extensions to another folder before it would work. I also had to turn on the develop menu to run unsigned extensions.

i tried ublock origin ,which was successful, but fails to do anything in Safari, and Synology Note Clipper which again was successful, it let me log into my synology nas, but that was it. I also had to change one of the icon png files to a 128x128 pixel icon.

There are a few others I will try when I have time.
 

walterpaisley

macrumors 6502
Original poster
Oct 27, 2004
361
363
Springfield
Good point about the unsigned extensions - I forgot about this as I'm signing my extensions. I'll add that to the instructions.
 

upsguy27

macrumors 65816
Jun 25, 2007
1,210
19
Utah
I've been using this new cli tool extensively! It's been an absolute dream, haha, I've so far converted Reddit Enhancement Suite, Imagus, OctoLinker, Lovely Forks, and a couple of others ? aside from a few tweaks I had to manually do, and aside from some preferences not working for some extensions, everything works great! This tool is exactly what I have been wanting oh man

I've posted a couple of comments about my success with this in the relevant GitHub repositories for the extensions (in case anyone is curious or cares haha) https://github.com/musically-ut/lovely-forks/pull/52
 

markosb

macrumors 6502
Mar 19, 2010
384
55
Thanks, I’ll give it a shot. Do you think it would be better to use github versions of the file; if available. I’m first trying extensions I use in Microsoft Edge / Chrome... as those are the important ones. It’s nice to have this as an option, cause you never know if the developers will port them over.

Thanks for starting this thread.
 

Hjupter Cerrud

macrumors regular
May 5, 2020
105
94
Panama
I've been trying to convert different extensions but none of them shows up in the extensions panel I do have "Allow unsigned extensions" and other options enabled, do this works with the installed Safari version from Big Sur or do I need to get the preview version of Safari?
 

indra05d

macrumors newbie
Nov 21, 2020
1
0
For some reason it's not opening Xcode, I get a list of options... and the prompt.

Options:


--project-location The location to put the created Xcode project.


--app-name The name of the generated app.


--bundle-identifier The bundle identifier for the generated app.


--swift Use Swift in the generated app.


--objc Use Objective-C in the generated app.





Additional flags:


--copy-resources Copy the extension files to the generated project. If not specified, the project will reference the original extension files.


--no-open Do not open the generated Xcode project when complete.


--force Force overwriting the output directory if it exists.


--help Print this help te
 

stonerdt

macrumors newbie
Oct 25, 2013
26
7
I would love to have the 1Password extension for Chrome be converted to work back in Safari. I have 1Password 6 and the extension is non-existent now. If you can give any help, that would be great. I tried your steps and got the extension but it does not work. Thanks.
 

Sadrach

macrumors newbie
Dec 4, 2020
1
0
I've been using this new cli tool extensively! It's been an absolute dream, haha, I've so far converted Reddit Enhancement Suite, Imagus, OctoLinker, Lovely Forks, and a couple of others ? aside from a few tweaks I had to manually do, and aside from some preferences not working for some extensions, everything works great! This tool is exactly what I have been wanting oh man

I've posted a couple of comments about my success with this in the relevant GitHub repositories for the extensions (in case anyone is curious or cares haha) https://github.com/musically-ut/lovely-forks/pull/52
hi, how did you make imagus work? does not open and in terminal it throws:

Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:

include_globs
persistent
downloads
incognito
history

?
 

trevc2

macrumors newbie
Feb 5, 2021
1
0
Could you help me converting one extension? This is literally the only reason why I use chrome. I would be more than happy to ditch it completely if I get it working on safari. If you can help me convert that I would be sooooo grateful!!!!


I really hope someone ports LiuChan over!

In the mean time you can try: https://apps.apple.com/us/app/popover-chinese/id1548419843?mt=12
It works fairly well. Same behavior.
 

walterpaisley

macrumors 6502
Original poster
Oct 27, 2004
361
363
Springfield
@tomptapple I tried building that extension and it loads in Safari and you can view the settings, but the extension itself doesn't seem to work. It's going to require more than a simple code conversion to work unfortunately.
 

tony12345

macrumors newbie
Mar 6, 2021
2
0
Hi All, I'm new to this but would like to convert a Chrome extension to Safari. I've followed this guidance and the guidance on the Apple Developer page, but cannot get this to work.

I enter in the Terminal:
xcrun safari-web-extension-converter

It says:
scrub: error: unable to find utility "safari-web-extension-converter", not a developer tool or in PATH.

I originally tried this on Xcode 12.5 Beta. Thinking this utility may not have been included in 12.5 for some reason, I uninstalled it and installed Xcode 12.4 from the App Store. Unfortunately, that also doesn't have safari-web-extension-converter (that I could find).

I'm obviously missing something... Does anyone have any thoughts on what might be going on? Is there a way I can do this within Xcode itself if the extension isn't found?

I am running macOS Big Sur 11.2.2 on a MacBook Pro with Apple Silicon.

Thanks in advance for any thoughts you might have!
 

walterpaisley

macrumors 6502
Original poster
Oct 27, 2004
361
363
Springfield
Try launching the terminal and reselecting your Xcode install as the primary. Type:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

or if you're running a beta version,

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

And then try running the xcrun safari-web-extension-converter script again.
 
  • Like
Reactions: addamas

tony12345

macrumors newbie
Mar 6, 2021
2
0
That did it! Thank you1 :)

For my learning, can you help me understand what happened? When I installed XTools, was there something I did wrong there? I just used the default settings in installation.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.