Articles of mac osx

如果服务是手动启动的,是否可以通过launchd停止服务?

我正在使用launchd在启动时启动mysql,它工作正常。 我能够使用“launchctl卸载”和“launchctl加载”命令停止并启动服务。 另外,我可以通过在terminal中input“mysqld_safe”命令来启动服务。 但是,如果我通过“launchctl stop”停止服务,然后通过“mysqld_safe”命令启动服务,则无法通过“launchctl stop”停止服务。 这可能吗? 我在这里做错了什么? 我的Plist是: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>mysql.service</string> <key>ProgramArguments</key> <array> <string>/path/to/mysql/bin/mysqld_safe</string> <string>–defaults-file=/path/to/mysql/my.cnf</string> <string>–port=3306</string> <string>–socket=/path/to/mysql/tmp/mysql.sock</string> <string>–datadir=/path/to/mysql/data</string> <string>–log-error=/path/to/mysql/data/mysqld.log</string> <string>–pid-file=/path/to/mysql/data/mysqld.pid</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <false/> <key>UserName</key> <string>_mysql</string> <key>GroupName</key> <string>_mysql</string> <key>StandardOutPath</key> <string>/tmp/mysql_start.out</string> <key>StandardErrorPath</key> <string>/tmp/mysql_start.err</string> </dict> </plist> 用于通过terminal启动mysql的命令是: mysqld_safe –defaults-file=/path/to/mysql/my.cnf –port=3306 –socket=/path/to/mysql/tmp/mysql.sock –datadir=/path/to/mysql/data –pid-file=/path/to/mysql/data/mysqld.pid

从bash获取执行的源代码

好吧,这是最后一次尝试,看看我是否能够挽救我不小心做的事情。 我不小心做了“ command >〜/ .profile”而不是“ command >>〜/ .profile”在我的电脑上。 我没有版本控制(从来没有再次发生),由于.profile当时没有在编辑器中打开,我没有任何备份文件或Vim缓冲区中的现有版本。 我现在唯一可能想到的是,我仍然有一个terminal会话,在我上面的错误之前,运行〜/ .profile文件中的行。 我的问题是:有没有办法获得当前执行的源代码? 如果我运行,也许更明确和通用 source ~/.profile 有没有什么方法可以查看在terminal会话中执行的内容,而不是查看源文件? 经验教训,版本所有你的dotfiles。 提前致谢。 -Hassan

OS X服务器忽略虚拟主机

我有一个OS X服务器10.8 [与服务器应用程序]。 我已经启用了网站服务,我已经添加了/Volumes/dev1/http的path作为我的服务器网站的根目录。 我在/private/etc/apache2/httpd.conf编辑了文件并添加了以下行: Include /Volumes/dev1/http/.virtual-hosts /Volumes/dev1/http/.virtual-hosts的文件如下所示: listen 80 listen 443 servername "site" serveradmin "[email protected]" namevirtualhost *:80 namevirtualhost *:443 directoryindex .index.php index.html index.php options -indexes -multiviews +followsymlinks <directory /Volumes/dev1/http> allowoverride all </directory> <virtualhost *:80 *:443> servername site.com serveralias www.site.com documentroot "/Volumes/dev1/http/com-site" rewriteengine on </virtualhost> 服务器完全忽略了这个文件,即使我把一些随机的字符放到apachectl -t里面 – 它说那个语法不行。 我甚至尝试过在这个文件中只有directoryindex .index.php ,它仍然没有效果 – 它返回403禁止,甚至认为.index.php存在。 这个确切的configuration就像一个老式的10.6服务器的魅力。 […]

nginx只会在虚拟主机上下载一个文件

我想在Mac上移植我的本地环境来使用nginx 从日志我第一次得到[emerg] 9449#0: bind() to 0.0.0.0:80 failed (13: Permission denied)但运行sudo nginx解决了这个 现在如果我input地址http://njsphp.dev ,它只是下载一个文件? 在conf我已经设置了一个虚拟主机,我已经把名字放在hosts文件中 server{ listen 80; listen njsphp.dev; server_name njsphp.dev; root /Users/redres/Webdev/nodejsphp; index index.phtml index.htm; location / { } } 谢谢

小牛升级后PHPStorm问题

我升级到Mac OS小牛,从那时起我的PHPStorm引起了问题。 在编辑器内部打字时,CPU上升到400%,打字滞后。 我不知道该怎么做,或者是什么原因。 所以我重新安装了小牛。 在一个干净的安装PHPStorm工作正常,没有滞后。 然后我将所有的数据放回到我的SSD(从备份和只有个人数据,没有Java或系统二进制文件)。 我不知道这是否是原因,但是如果我input编辑器,PHPStorm现在再次落后。 你有没有经历类似的行为? 任何build议要寻找什么? 我不知道。

无法通过套接字“/opt/local/var/run/percona/mysqld.sock”连接到本地MySQL服务器

我已经安装percona服务器在我的Mac机上使用macports,但是我正在运行到上面的sockets错误,如下所示: Sauds-MacBook-Pro:percona jini$ sudo /opt/local/lib/percona/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root […]

Mac OS X 10.8.5添加到Windows域

我有一个Mac,我join到Windows域。 当机器离开networking并且连接到terminal时,它将机器的名称显示为HD_MACPRO。 当我连接到networking时,这个信息会改变,它认为它是另一个名字。 该名称通常是networking上有效的Windows机器。 有关这个原因的任何想法? 它可能是从DNS的名称? 如果是这样,我怎么能避免这一点?

nginx虚拟主机没有听正确的主机名

我是nginx的新手,但是我遇到了一个对我来说完全不明显的基本问题。 我在我的Mac上使用brew安装了nginx。 这工作得很好,这个基本的,不变的默认configuration: server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 现在,我是一个开发多个项目的开发人员。 以前我在apache中为每一个虚拟主机configuration了一个虚拟主机,与myproject1.local这样的自定义主机条目结合在一起。 所以,为了用nginxtesting这个,我编辑了我的/ etc / hosts文件并添加了: # /etc/hosts 127.0.0.1 mytestproject.local 然后,在nginxconfiguration中,我添加了以下内容: server { listen 8080; listen mytestproject.local:80; server_name mytestproject.local; location / { root […]

编译PHP的问题make:*** 错误1

这是我得到的消息: Undefined symbols for architecture x86_64: "_iconv_close", referenced from: _zif_iconv_substr in iconv.o _zif_iconv_mime_encode in iconv.o _php_iconv_string in iconv.o __php_iconv_strlen in iconv.o __php_iconv_strpos in iconv.o __php_iconv_mime_decode in iconv.o _php_iconv_stream_filter_cleanup in iconv.o … "_iconv_open", referenced from: _zif_iconv_substr in iconv.o _zif_iconv_mime_encode in iconv.o _php_iconv_string in iconv.o __php_iconv_strlen in iconv.o __php_iconv_strpos in iconv.o __php_iconv_mime_decode in iconv.o _php_iconv_stream_filter_factory_create in iconv.o […]

重新启动后的PHP-FPM用户权限

出于某种原因,我重新启动php-fpm后台程序后,使用PHP(Twig模板caching)生成的文件无法再被PHP访问。 我想这是关于php-fpm用户/组(_www / _www)。 Unable to write in the cache directory (/Users/iber/Work/Projects/Work/app/public/assets/compile/3f/87) 唯一的解决办法是完全删除文件夹内容并重新加载Twig的页面来重新编译文件。 compile目录有0777权限。 php-fpm(v5.5)通过自制软件安装。 这里可能是什么问题?