Mac 的m1开发前基础设置,homebrew,oh-my-zsh,maven,mysql,jdk,tomcat,idea

本文介绍如何在Mac M1上配置基本的开发环境,包括安装Homebrew、Oh My Zsh、Maven、MySQL、Tomcat及JDK等工具,并提供详细的步骤说明。

Mac 的m1开发前基础设置,homebrew,oh-my-zsh,maven,mysql,jdk,tomcat,idea

我的系统配置:

terminal是zsh的,一般新电脑都是默认的zsh:

1、安装 ARM 版 Homebrew

1)、首先创建安装目录

sudo mkdir -p /opt/homebrew

2)、将目录属主修改为当前用户,方便以后用当前用户直接brew install软件

sudo chown -R $(whoami) /opt/homebrew

3)、进入 /opt 文件夹

cd /opt

4)、直接下载homebrew tar包并解压

curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

或者使用我提供的脚本安装,好处是安装脚本可稳定访问,安装默认使用中科大镜像:

设置homebrew-core镜像

HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git
​
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

5)、将路径增加到PATH环境变量中

然后还需要设置下环境变量,在~/.zshrc或者~/.bashrc文件末尾追加下面代码。

export PATH=/opt/homebrew/bin:$PATH

注意:如果你确定使用的终端是zsh,那请编辑.zshrc文件,否则请操作.bashrc文件。

以.zrc为例,在终端执行下面代码可以直接追加内容并让文件生效:

echo export PATH=/opt/homebrew/bin:$PATH >> ~/.zshrc 
source ~/.zshrc

6)、验证是否安装成功

brew

执行完显示下图就表示安装成功:

2、安装oh-my-zsh

1)、安装

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

2)、导入模版配置

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
vi ~/.zshrc #看看是否已经拷贝进去
source ~/.zshrc #更新zsh 看是不是已经生效

3、通过homebrew安装maven

1)、下载Maven

brew install maven will install Maven 3.6.3  #版本可以不加,默认下载最新的
如果安装失败,可以多次执行安装命令,本人就是安装三次才安装成功的

2)、配置环境变量

在Terminal中输入以下命令

vi ~/.zshrc

3)、按i 进入编辑模式

#maven
    export M2_HOME=/usr/local/Cellar/maven/3.6.3/libexec(此处为自己的libexec的绝对路径)
    export PATH=$PATH:$M2_HOME/bin 
  esc退出,使用:wq 退出保存。

4)、刷新配置文件

source ~/.zsrc

5)、测试安装结果

mvn -v

显示一下结果,表示安装成功:

4、通过homebrew安装mysql

1)、安装

brew install mysql
#想要安装指定版本的mysql
brew install mysql@5.7(5.7为指定版本号)

2)、配置环境变量

# 终端
echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
/opt/homebrew/opt/mysql@5.7/bin是bin在mysql里的指定目录
# 刷新 ~/.zshrc
source ~/.zshrc

3)、查看版本

nichengjing@nichengjingdeMacBook-Air ~ % mysql --version
mysql  Ver 14.14 Distrib 5.7.34, for osx10.16 (x86_64) using  EditLine wrapper

4)、启动

mysql.server start  # 启动mysql
mysql.server stop # 停止mysql
mysql.server restart # 重启mysql

5)、初始化

任意路径执行命令:mysql_secure_installation,交互过程中不断输入y或者n,可以修改密码。

Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: n    // 这个选yes的话密码长度就必须要设置为8位以上,但我只想要6位的
Please set the password for root here.
New password:
Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y          // 移除不用密码的那个账户
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n      //不接受root远程登录账号
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y     //删除text数据库
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately. 
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!

安装完成

5、通过homebrew下载tomcat

1)、安装tomcat

brew install tomcat

2)、检查是否安装成功:

catalina -h

3)、运行tomcat:

catalina run

4)、运行成功后

Tomcat的默认端口是8080,如果运行成功可通过[http://localhost:8080](https://link.jianshu.com/?t=http%3A%2F%2Flocalhost%3A8080)访问

5)、关闭tomcat

catalina stop

6、下载JDK

基于ARM的zulu:8.52.0.23下载快快,官网就是下载的时候有点慢
下载地址:azul.com

7、下载idea安装包

直接到官网上下载

M1的话一定要记得选择这个版本的IDEA。

内容概要:本文档是一份针对全国大学生电子设计竞赛(NUEDC)的“保姆级”实战指导手册,系统涵盖赛题解析与方案库、模块化代码与电路实现、以及测试报告范例三大核心部分。手册深入剖析了电赛七大赛题类别及其命题规律,强调“基本要求+发挥部分”的结构特点、指标逐年收紧趋势及测量与控制复合型题目的增加。通过数控直流电流源和频率特性测试仪两个典型案例,展示了从系统方案设计、关键器件选型到软硬件实现的完整路径。同时,提供了基于STM32 HAL库的ADC采样、PWM生成、OLED显示、无线通信等常用模块的详细电路原理与驱动代码,并辅以测试报告范例和评分标准解析,帮助参赛者规范撰写高质量设计报告。; 适合人群:参加全国大学生电子设计竞赛的本科生及指导教师,尤其适合有一定单片机和电路基础、希望在短时间内高效备赛并提升获奖概率的团队。; 使用场景及目标:①帮助参赛者快速掌握电赛命题规律与主流技术方案,精准应对电源类、控制类、仪器仪表类等高频赛题;②提供可复用的模块化代码与电路设计,加速硬件搭建与软件开发进程;③指导撰写符合评审标准的设计报告,强化误差分析与测试数据呈现,提升综合得分。; 阅读建议:建议按照“赛题分析→方案设计→模块实现→报告撰写”的流程顺序阅读,重点学习典型案例的整体设计思路与关键器件选型依据。对于代码与电路部分,应在实际开发板上动手验证,结合示波器、逻辑分析仪等工具进行调试。撰写报告时,务必参考文中测试表格与误差分析模板,确保数据完整、分析定量,避免因报告不规范而失分。;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值