如何使程序在OSX中自动启动? [英] How can I make a program start up automatically in OSX?

查看:95
本文介绍了如何使程序在OSX中自动启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小程序,要在启动Mac时自动将其打开.

I have a little program that I want to make open automatically when my mac is started up.

因为该程序接受命令行参数,所以它不像进入系统偏好设置/帐户/登录项并将其添加到其中一样简单...

Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there...

从google上了解到,我可以在用户的​​主文件夹中创建一个.profile文件,该文件将执行我放入其中的任何内容...因此,我在〜这样的.profile页面中有这样的内容:

From google, I read that I can create a .profile file in my user's home folder, and that will execute whatever I put in it... So I have a .profile page in ~ like this:

-rw-r--r-@ 1位哑光人员27 27 Sep 13:36 .profile

-rw-r--r--@ 1 matt staff 27 27 Sep 13:36 .profile

其中包含这个...

/Applications/mousefix 3.5

/Applications/mousefix 3.5

但是它不会在启动时执行!如果我在终端中手动输入"/Applications/mousefix 3.5",它将起作用.

But it doesn't execute on startup! If I enter "/Applications/mousefix 3.5" manually into the terminal, it does work.

有什么想法吗?

推荐答案

从这里开始,直到将来,请查看 launchd 表示您要执行的操作.所有其他方法已被弃用或现在不被支持.不过,这可能比您想要的要重一些.

From here and into the future, look into launchd for what you want to do. All other methods have been deprecated or are now unsupported. This is probably a bit more heavy-weight than what you want, though.

您的bash shell版本未正确执行.profile也可能是一个问题.尝试将命令放入主目录的.bashrc中,看看是否有帮助.

It could also be a problem with your version of the bash shell not correctly executing your .profile. Try putting the command into .bashrc in your home directory, and see if that helps.

这篇关于如何使程序在OSX中自动启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆