您的位置:首页 > 其它

Mac 部分开发环境配置(移动开发)及一些常用命令

2015-08-18 10:23 621 查看
这是我个人开发需要的,在此记录,以便下次使用。

xcode

xcode 通过appstore安装

cocoapods

gem sources –remove https://rubygems.org/

//等有反应之后再敲入以下命令

gem sources -a http://ruby.taobao.org/

sudo gem install cocoapods

需要到项目里再执行pod install

svn

svn 命令行输入命令,自动安装

安装 brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"[/code] 
网址:http://brew.sh/

ionic

brew install wget
brew install node
sudo npm install -g cordova
sudo npm install -g ionic
npm install -g ios-sim
npm install -g ios-deploy


sass

gem install sass
gem install compass


gapdebug

https://www.genuitec.com/products/gapdebug/

nginx mysql php

nginx

brew install nginx       //访问:http://localhost:8080
nginx目录: /usr/local/etc/nginx


mysql

brew install mysql
mysql_install_db --verbose --user=root --basedir="$(brew --prefix mysql)"--datadir=/usr/local/var/mysql --tmpdir=/tmp


启动:

mysql.server start
mysql -uroot -p


设置开机启动:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.6.16/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ #5.6.16是数据库版本号
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist


设置密码

mysqladmin -u root password "newpass"
或
mysqladmin -u root password oldpass "newpass"


php

brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php55 --with-debug --with-fpm --with-gmp --with-homebrew-openssl --with-imap --with-intl --with-libmysql --without-bz2 --without-mysql --without-pcntl --without-pear


注意–with-cgi不能和–with-fpm一起安装

通过命令查看PHP版本,如果不是安装的版本,则要修改path

php -v

修改:

vim .profile
export PATH=/usr/local/bin:$PATH


php 配置文件位置

/usr/local/etc/php/5.5/php.ini
php-fpm  /usr/local/etc/php/5.5/php-fpm.conf
php-fpm  //启动php-fpm


修改 ~/.bashrc(没有则创建),最后加入一行

export PATH=”(brew−−prefixphp54)/bin:PATH”

保存后

source ./.profile

phpmyadmin

下载后,配置到apache,个性config.default.inc.php

禁止空密码

$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['nopassword'] = true;


设置密码

$cfg['blowfish_secret'] = 'rootsdfef';

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';


一些命令

nginx命令

重新加载|重启|停止|退出 nginx
nginx -s reload|reopen|stop|quit
配置文件位置:
/usr/local/etc/nginx/nginx.conf
默认的文件访问目录(root)是 /usr/local/Cellar/nginx/*.*.*/html


brew

brew info nginx  查看信息


查看端口是否占用

lsof -i tcp:8080


profile说明

/etc/profile 每个用户设置的环境信息,当用户第一次登陆时,该文件被执行,并从/etc/profile.d搜集shell的设置。设定的全局变量可以作用于任何用户。

/etc/bashrc 为每一个运行bash shell的用户执行此文件。当bash shell被打开时,该文件被读取。只能继承/etc/profile中的变量。

~/.bash_profile 每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登陆时,该文件仅仅执行一次。黑夜情况下,它设置一些环境亦是执行用户的.bashrc文件。交互式、login方式进入bash运行

~/.basrc 该文件包含专用于bash shell的bash信息,当登陆时以及每次打开新的shell时,该文件被读取。交互式、non-login方式进入bash运行。

~/.bash_logout 每次退出系统(退出bash shell)时,执行该文件。

设置生效:

alias php=/var/php
source /etc/profile


显示系统隐藏文件

显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles  YES
隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles  NO
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: