macos 如何在 macosx 上删除 apache 的自动启动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8065288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:35:36  来源:igfitidea点击:

How to remove autostart of apache on macosx

macosapache

提问by toutpt

I'm on a macosx lion. A service is up and running on localhost:8080.

我在 macosx 狮子上。一项服务已在 localhost:8080 上启动并运行。

This service is an apache + php packaged by entreprisedb.

该服务是entreprisedb打包的apache+php。

How could I remove the autostart ?

我怎样才能删除自动启动?

回答by Erik

1)The autostart is usually not in the User-Autostart-Items, but you should check them anyway:

1)自动启动通常不在 User-Autostart-Items 中,但您无论如何都应该检查它们:

Open the System-Preferences> Users> Select your user> Start-Objects

打开System-Preferences> Users> Select your user> Start-Objects

Check if there is something started you want to deactive and do so if.

检查是否有您想要停用的内容,如果有,请执行此操作。

2)Normally the start of apache is handled by the launchd-service: You can either change this manually, or with the help of a old little tool named "Lingon". To do it manually, you need to find the launchd-folders:

2)通常 apache 的启动是由 launchd-service 处理的:您可以手动更改它,或者借助一个名为“ Lingon”的旧小工具。要手动执行此操作,您需要找到 launchd 文件夹:

~/Library/LaunchAgents
~/Library/LaunchDaemons

/Library/LaunchAgents
/Library/LaunchDaemons

/System/Library/LaunchAgents
/System/Library/LaunchDaemons

There you'll find .plist-files, that define when and what to start. To remove a object from auto-start use launchctl on the terminal to remove it from the actual launchd and then simply delete the file.

在那里你会找到 .plist-files,它定义了开始的时间和内容。要从自动启动中删除对象,请在终端上使用 launchctl 将其从实际的 launchd 中删除,然后只需删除该文件。

user$ launchctl unload *filename.plist*

Make sure you do not delete the wrong files! This may lead to a fatal situation on your machine. Btw: The .plist-Files can be read with BBEdit, TextWrangleror the PropertyList Editorfrom the Apple Developer-Tools.

确保您没有删除错误的文件!这可能会导致您的机器出现致命情况。顺便说一句:在的.plist档案可以被读取BBEdit中的TextWrangler对propertyList编辑苹果开发者工具

回答by leepowers

On Mountain Lion (OSX 10.8.5) I was able to disable the Apache server that ships with OSX using the following command:

在 Mountain Lion (OSX 10.8.5) 上,我能够使用以下命令禁用 OSX 附带的 Apache 服务器:

sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist

This particular command probably won't work if a different version of Apache was installed via MacPorts or HomeBrew.

如果通过 MacPorts 或 HomeBrew 安装了不同版本的 Apache,则此特定命令可能不起作用。

The use of sudois important, as Apache needs root privileges to run on a low-numbered, protected port number (port 80).

的使用sudo很重要,因为 Apache 需要 root 权限才能在低编号、受保护的端口号(端口 80)上运行。

回答by Guilsson

Erik's answer it's almost a complete list of places where you can found startup items. There are two others places where I've found several apps starting up even if you press SHIFT during login.

Erik 的回答几乎是您可以找到启动项的完整列表。在另外两个地方,我发现即使您在登录过程中按 SHIFT 也会启动多个应用程序。

/private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

/private/var/db/launchd.db/com.apple.launchd/overrides.plist

/private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

/private/var/db/launchd.db/com.apple.launchd/overrides.plist

You can read them using:

您可以使用以下方法阅读它们:

defaults read /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

sudo defaults read /private/var/db/launchd.db/com.apple.launchd/overrides.plist

默认读取/private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

sudo 默认读取 /private/var/db/launchd.db/com.apple.launchd/overrides.plist

回答by mljrg

It is enough to do sudo apachectl stop.

做就够了sudo apachectl stop

Then to start it do sudo apachectl start. This will also make the web server start on system start too.

然后开始吧sudo apachectl start。这也将使 Web 服务器在系统启动时启动。

This works as I am telling you because these commands call `launchctl`` under the hood. You can verify this by running

这正如我告诉你的,因为这些命令在后台调用了 `launchctl`。您可以通过运行来验证这一点

$ cat `which apachectl`