Skip to content

macos support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pfriesch opened this issue May 6, 2021 · 11 comments
Closed

macos support #1

pfriesch opened this issue May 6, 2021 · 11 comments

Comments

@pfriesch
Copy link

pfriesch commented May 6, 2021

What is currently missing for macos support? (except signing the executable)
I am also happy to take a look and create a pull request, but I would appreciate some hints on the current state then 👍

@ghost
Copy link

ghost commented May 16, 2021

ikr. I really hope a macos version comes out soon

@th3fallen
Copy link

+1 to this

@rinkjames
Copy link

+1

@MattHardcastle
Copy link

I compiled the connector on macOS and manually linked the manifest in Firefox. After that, I used the plugin to create a new profile and launch it. Looks like the guts work fine on macOS.

@null-dev created a Homebrew tap repository for the plugin. I bet they just need to wrap that and the macOS build up to get this running.

I’ll take a stab at replicating the macOS build and setting up the tap.

In case it’s helpful, here’s my quick and dirty approach to get it working:

git clone [email protected]:null-dev/firefox-profile-switcher-connector.git
cd firefox-profile-switcher-connector
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
cargo build
ln $(pwd)/target/debug/firefox_profile_switcher_connector /usr/local/bin/ff-pswitch-connector
ln $(pwd)/manifest/manifest-mac.json ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json

And the following is the version macOS I’m running:

$ sw_vers
ProductName:	macOS
ProductVersion:	11.3.1
BuildVersion:	20E241

@MattHardcastle
Copy link

MattHardcastle commented May 22, 2021

I've added newer install instructions below.

I've been able to get the connector building and installing with the follow Formula:

# Formula/firefox-profile-switcher-connector.rb
class FirefoxProfileSwitcherConnector < Formula
  desc "The native component of the Profile Switcher for Firefox extension."
  homepage "https://github.com/null-dev/firefox-profile-switcher-connector"
  url "https://github.com/null-dev/firefox-profile-switcher-connector/archive/refs/tags/v0.0.6.tar.gz"
  sha256 "40f0429f2aeebd128072a75674e132477ef1f16ce03d77704fa55395624a62fc"
  version "0.0.6"
  depends_on "rust" => :build

  def install
    system "cargo", "build", "--release", "--bin", "firefox_profile_switcher_connector"
    prefix.install "manifest/manifest-mac.json" => "ax.nd.profile_switcher_ff.json"
    bin.install "target/release/firefox_profile_switcher_connector" => "ff-pswitch-connector"
  end

  def caveats
    <<~EOS
       The plugin manifest needs to be installed in Firefox. Run the following to install it:
        "ln -s #{HOMEBREW_CELLAR}/firefox-profile-switcher-connector/0.0.6/ax.nd.profile_switcher_ff.json /Users/#{ENV["USER"]}/Library/Application\ Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json"
    EOS
  end

end

(I'd add that as a PR to homebrew-firefox-profile-switcher but I can't create a PR on an empty repository. 🥲)

The issue is, I can't install the manifest in Firefox with Homebrew. When I attempt to copy it I get a "Operation not permitted" error. That error is probably SIP blocking full disk access for brew.

I'm going to see if I can get cargo to produce a pkg file that will install the manifest in the correct place. 🤞🏻

(edit: updated Formula w/caveat to link manifest.)

@th3fallen
Copy link

I compiled the connector on macOS and manually linked the manifest in Firefox. After that, I used the plugin to create a new profile and launch it. Looks like the guts work fine on macOS.

@null-dev created a Homebrew tap repository for the plugin. I bet they just need to wrap that and the macOS build up to get this running.

I’ll take a stab at replicating the macOS build and setting up the tap.

In case it’s helpful, here’s my quick and dirty approach to get it working:

git clone [email protected]:null-dev/firefox-profile-switcher-connector.git
cd firefox-profile-switcher-connector
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
cargo build
ln $(pwd)/target/debug/firefox_profile_switcher_connector /usr/local/bin/ff-pswitch-connector
ln $(pwd)/manifest/manifest-mac.json ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json

And the following is the version macOS I’m running:

$ sw_vers
ProductName:	macOS
ProductVersion:	11.3.1
BuildVersion:	20E241

can confirm this worked for me

@null-dev
Copy link
Owner

@MattHardcastle Wow, thank you so much for writing the formula! I'm a total noob regarding packaging apps for Mac OS so this is a big help. I've added an empty commit to the repo so now you should be able to open a PR.

@MattHardcastle
Copy link

MattHardcastle commented May 29, 2021

@null-dev No problem. Thanks for making the plugin! I create a PR for the formula. It's not able to install the manifest. I have to ask the installer to manually link it, but it does the build and installs the connector.

@MattHardcastle
Copy link

MattHardcastle commented Jun 5, 2021

The tap is live. To install the connector w/Homebrew run the following:

brew tap null-dev/firefox-profile-switcher
brew install firefox-profile-switcher-connector

Pay special attention to the caveat section while installing.

The connector is not working on Apple Silicon. It works in Rosetta.

@MattHardcastle
Copy link

MattHardcastle commented Jun 6, 2021

I asked the Homebrew folks if it's possible to create a file in ~/Library. It's not. The other option is to bundle this as a pkg, have the pkg create the manifest, then install the package as a cask.

The problem is, Rust doesn't appear to support universal binaries -- they are working on it -- so creating a pkg that works on Apple Silicon and Intel Macs may not be possible until Rust supports them. (This isn't an issue with the current Homebrew install because it's built from source on every install.) Creating a universal binary is possible by compiling a aarch64-apple-darwin and x86_64-apple-darwin target and using the lipo command to merge them.

I see a couple of options (in no particular order):

  1. Reimplement in a language that's supported on all platforms and uses the Clang toolchain, which supports universal binaries, on macOS. Maybe C++ and CMake. Lipo supports rust compiled binaries. There is no need to use the full clang toolchain.
  2. Deal with the caveat message and call it supported(ish). Then reevaluate once Rust supports universal binaries.
  3. Create a package for each architecture universal app package, add them to the downloads page, and forget about Homebrew.

(Edited: I learned more about universal binaries and how to build them.)

@null-dev
Copy link
Owner

The latest version now includes instructions on how to install the connector on Mac OS. Thanks again Matt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants