OS X 终端颜色 [英] OS X Terminal Colors
问题描述
我是 OS X 的新手,在使用 Ubuntu Linux 一段时间后刚刚获得了一台 Mac.在我试图弄清楚的许多事情中,我的终端窗口中没有颜色——就像在运行 ls -la
或 git status<时(在 Linux 上)显示的那些/代码>...
I'm new to OS X, having just gotten a Mac after working with Ubuntu Linux for some time. Among the many things I'm trying to figure out is the absence of colors in my terminal window - like the ones that are shown (on Linux) when running ls -la
or git status
...
我就是不知道如何在我的外壳中激活颜色.
I just can't figure out how to activate colors in my shell.
推荐答案
这是我找到的一个解决方案终端颜色.
Here is a solution I've found to enable the global terminal colors.
编辑您的 .bash_profile
(从 OS X 10.8 开始)——或(对于 10.7 及更早版本):.profile
或 .bashrc
或 /etc/profile
(取决于可用性)——在您的主目录中并添加以下代码:
Edit your .bash_profile
(since OS X 10.8) — or (for 10.7 and earlier): .profile
or .bashrc
or /etc/profile
(depending on availability) — in your home directory and add following code:
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
CLICOLOR=1
只是启用终端的着色.
CLICOLOR=1
simply enables coloring of your terminal.
LSCOLORS=...
指定如何为特定项目着色.
LSCOLORS=...
specifies how to color specific items.
编辑 .bash_profile
后,启动终端并通过执行强制更改发生:
After editing .bash_profile
, start a Terminal and force the changes to take place by executing:
source ~/.bash_profile
然后去终端>首选项
,点击Profiles
标签,然后点击Text
子标签并检查Display ANSI Colors
.
Then go to Terminal > Preferences
, click on the Profiles
tab and then the Text
subtab and check Display ANSI Colors
.
在 Sierra 上验证(2017 年 5 月).
这篇关于OS X 终端颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!