thisiscam / math-with-slack

Rendered math (MathJax) with Slack's desktop client
MIT License
306 stars 28 forks source link

Install script fails on latest macOS #52

Closed mirams closed 1 year ago

mirams commented 1 year ago

I'm on the new macOS Sonoma 14, and Slack Version 4.34.121. The install script fails with:

% sudo python3 math-with-slack.py
Using Slack installation at: /Applications/Slack.app/Contents/Resources/app.asar
/Users/pmzgm/Downloads/math-with-slack.py:760: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  return LooseVersion(json.load(f)["version"])
/Users/pmzgm/Downloads/math-with-slack.py:739: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if get_platform() == "darwin" and slack_version >= LooseVersion("4.22"):
[Errno 1] Operation not permitted: '/Applications/Slack.app/Contents/Resources/app.asar'
Cannot modify /Applications/Slack.app/Contents/Resources/app.asar. Make sure the script has write permissions. Possibile fix:
    Seems like you are using MacOS. Perhaps your Slack is installed through App Store?
    If that's the case, you will need to use `sudo` to give the script enough permissions. Please check README for more details.

suggesting a permissions issue, but I am running with sudo. Any advice?

thisiscam commented 1 year ago

I have not upgraded yet. Will reproduce shortly this week or next when I get time. Just to make sure, you did't install from Mac AppStore right?

Mert-Okyay commented 1 year ago

having the same issue. running M2 mac mini and using the website installation for M1/M2. any updates?

thisiscam commented 1 year ago

I just updated to Sonoma. The script appears to still work for me. I have the x86 chip.

sudo python math-with-slack.py --macos-codesign

Note the --macos-codesign flag.

thisiscam commented 1 year ago

I searched a bit more, and it seems like some people have similar issues with other softwares:

Perhaps try the methods mentioned in these threads, if --macos-codesign option above is not sufficient?

For the first link, perhaps try

sudo chflags nouchg,noschg /Applications/Slack.app/Contents/Resources/app-{your achitecture}.asar

For the second link, something like this:

# Change script to executable 
chmod +x math-with-slack.py

# Give enough permission to ./math-with-slack.py so that it can access `/Applications/Slack.app/Contents/Resources/app-{your achitecture}.asar` 
# follow the post in https://nono.ma/operation-not-permitted-macos-sonoma

# run the script
sudo ./math-with-slack.py --macos-codesign
mirams commented 1 year ago

I ran with --macos-codesign and initially had the same problem. Then I found this setting in the Privacy & Security section:

image

and switching that on as well worked, thanks.

Mert-Okyay commented 1 year ago

the app management thing worked for me, thanks!!! However, now everytime i quit slack i have to relogin. anyone have this?

thisiscam commented 1 year ago

the app management thing worked for me, thanks!!! However, now everytime i quit slack i have to relogin. anyone have this?

That symptom sounds like you weren't using the codesign option?

Mert-Okyay commented 1 year ago

I did use the codesign option.

thisiscam commented 1 year ago

I did use the codesign option.

Hmm. I don't have this issue. Perhaps try reinstalling Slack? Make sure it's opened once before running the script. Once you installed, the next time you open Slack it should prompt for root permission. If it's not doing that, there's likely something failed with code signing

Mert-Okyay commented 1 year ago

So you are right, last time it did not ask for anything so I did reinstall and run the script again (opened slack one time before running the script) and now it asks for "slack safe storage" in the keychain, and requires a password for each channel I am in. Super weird...

thisiscam commented 1 year ago

So you are right, last time it did not ask for anything so I did reinstall and run the script again (opened slack one time before running the script) and now it asks for "slack safe storage" in the keychain, and requires a password for each channel I am in. Super weird...

I think you are seeing the intended behavior now. Glad that it worked out!