'nice' не работает, даже если используется 'sudo'. "Доступ запрещен"

1335

Я пытаюсь установить приоритет для приложения, чтобы он был выше, но я продолжаю получать «отказано в разрешении», когда пытаюсь сделать сом даже в роли суперпользователя. Из терминала: Alexandsteins-Macbook:~ alexanderstein$ sudo nice -n -10 /Applications/Minecraft.app nice: /Applications/Minecraft.app: Permission denied

1

1 ответ на вопрос

1
Petesh

firstly, you need to nice the program that is launched. You're pointing at a directory. Applications on mac os are files within the application bundle.

The file you're looking for will be located within the directory:

/Applications/Minecraft.app/Contents/MacOS 

I don’t have minecraft, so I don’t know what the file is called.

you can nice that file, which should have the desired effect.

You could use a little bit of applescript to accomplish something similar (it's not exactly the same):

tell application "Minecraft" activate delay 1 end tell tell application "System Events" to set pid to unix id of process "Minecraft" do shell script ("renice -10 -p " & pid) password "xxxxxxxxx" with administrator privileges 

You can either replace the xxxxxxxxx with your password, or else omit the entire password "xxxxxxxxx", and have the UI prompt you for an administrator account to perform the task.

This will also work with running copies of minecraft.

To get the applescript to run, you can use the applescript editor to create a scriptlet, or put it into a simple text file, and run it using osascript textfile.

Ах хорошо. Итак, вы должны указать на фактический двоичный штраф, тогда? 11 лет назад 0
Да, я добавлю немного яблочного сценария, который может сделать что-то подобное Petesh 11 лет назад 1