<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mac &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Sat, 20 Jan 2024 17:24:55 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] MacOS下的那些diff工具</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8b%e7%9a%84%e9%82%a3%e4%ba%9bdiff%e5%b7%a5%e5%85%b7/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8b%e7%9a%84%e9%82%a3%e4%ba%9bdiff%e5%b7%a5%e5%85%b7/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 20 Jan 2024 17:01:51 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[colordiff]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[grc]]></category>
		<category><![CDATA[icdiff]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[meld]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=14003</guid>

					<description><![CDATA[<p>diff命令是最常用的、比较两个文本文件差异的工具。但在很多情况下，它并不那么好用，比如你想高亮显示差异的内容时，单纯的diff命令就做不到了。<br />
本文讨论了在macOS系统下，diff命令的一些&#8220;增强版&#8221;工具，让你用起来更方便。<br />
<span id="more-14003"></span><br />
<span style="color:#ff0000;">➤</span>&#160;安装、设置好 Homebrew 并保持最新<br />
在macOS里，为了方便快捷地安装各种软件包，首先你要装好Homebrew，具体过程这里不详述，可参考<a href="https://www.codelast.com/?p=14050" rel="noopener" target="_blank">这个</a>链接。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&#160;让 diff&#160;命令彩色化：通过&#160;grc&#160;配合<br />
单纯的 diff 命令本身并不直接提供高亮显示差异内容的功能。diff 命令通常输出两个文件之间的差异，包括新增的行、删除的行以及修改的行，但它使用的是标准的文本输出，没有颜色高亮。<br />
为了让 diff 命令输出彩色的内容，可以安装 grc（Generic Colouriser）软件：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&#160;install&#160;grc
</code></pre>
</section>
<p>安装完成后，修改 ~/.bash_profile&#160;文件，添加一行：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">alias</span>&#160;diff=<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&#39;/usr/local/bin/grc&#160;/usr/bin/diff&#39;</span></code></pre>
</section>
<p>然后重新打开终端，再用 <span style="color:#ff0000;">diff file1 file2</span>&#160;命令试一下，大概会是下面这样的效果：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="grc with diff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_1_grc_with_diff.png" style="width: 800px; height: 274px;" /></a><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&#160;colordiff&#160;软件：直接输出彩色的diff<br />
嫌上面安装&#160;grc&#160;的方法烦？可以直接安装&#160;colordiff&#160;软件：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&#160;install&#160;colordiff
</code></pre>
</section>
<p>再用 <span style="color:#ff0000;">colordiff file1 file2</span>&#160;命令来显示diff，大概会是下面这样的效果：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="colordiff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_2_colordiff.png" style="width: 800px; height: 273px;" /></a><br />
可以看到这个效果和 grc + diff&#160;差不多，所以考虑到简单，直接用colordiff就好了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8b%e7%9a%84%e9%82%a3%e4%ba%9bdiff%e5%b7%a5%e5%85%b7/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>diff命令是最常用的、比较两个文本文件差异的工具。但在很多情况下，它并不那么好用，比如你想高亮显示差异的内容时，单纯的diff命令就做不到了。<br />
本文讨论了在macOS系统下，diff命令的一些&ldquo;增强版&rdquo;工具，让你用起来更方便。<br />
<span id="more-14003"></span><br />
<span style="color:#ff0000;">➤</span>&nbsp;安装、设置好 Homebrew 并保持最新<br />
在macOS里，为了方便快捷地安装各种软件包，首先你要装好Homebrew，具体过程这里不详述，可参考<a href="https://www.codelast.com/?p=14050" rel="noopener" target="_blank">这个</a>链接。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;让 diff&nbsp;命令彩色化：通过&nbsp;grc&nbsp;配合<br />
单纯的 diff 命令本身并不直接提供高亮显示差异内容的功能。diff 命令通常输出两个文件之间的差异，包括新增的行、删除的行以及修改的行，但它使用的是标准的文本输出，没有颜色高亮。<br />
为了让 diff 命令输出彩色的内容，可以安装 grc（Generic Colouriser）软件：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;install&nbsp;grc
</code></pre>
</section>
<p>安装完成后，修改 ~/.bash_profile&nbsp;文件，添加一行：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">alias</span>&nbsp;diff=<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&#39;/usr/local/bin/grc&nbsp;/usr/bin/diff&#39;</span></code></pre>
</section>
<p>然后重新打开终端，再用 <span style="color:#ff0000;">diff file1 file2</span>&nbsp;命令试一下，大概会是下面这样的效果：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="grc with diff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_1_grc_with_diff.png" style="width: 800px; height: 274px;" /></a><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;colordiff&nbsp;软件：直接输出彩色的diff<br />
嫌上面安装&nbsp;grc&nbsp;的方法烦？可以直接安装&nbsp;colordiff&nbsp;软件：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;install&nbsp;colordiff
</code></pre>
</section>
<p>再用 <span style="color:#ff0000;">colordiff file1 file2</span>&nbsp;命令来显示diff，大概会是下面这样的效果：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="colordiff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_2_colordiff.png" style="width: 800px; height: 273px;" /></a><br />
可以看到这个效果和 grc + diff&nbsp;差不多，所以考虑到简单，直接用colordiff就好了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;icdiff：左右双屏的diff对比工具，很直观<br />
上面的diff命令，都是上下形式来展示，我觉得看起来很难受。icdiff 软件可以改变这种情况。安装：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;install&nbsp;icdiff
</code></pre>
</section>
<p>命令 <span style="color:#ff0000;">icdiff file1 file2</span>&nbsp;的效果如下：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="icdiff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_3_icdiff.png" style="width: 800px; height: 356px;" /></a><br />
看到没，不仅左右对照，而且还彩色高亮显示，超级直观！<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;vim -d：基于vim的左右双屏对比<br />
使用 <span style="color:#ff0000;">vim -d file1 file2</span>&nbsp;命令，就可以在vim中左右双屏展示差异了：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="vim -d" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_5_vim.png" style="width: 800px; height: 385px;" /></a><br />
但是注意：当一行内容太长的时候，vim在diff模式下不会把内容自动换行显示，看起来很不方便，你可以用 <span style="color:#ff0000;">:set wrap</span>&nbsp;命令来开启自动换行。<br />
如果要让光标在左右屏之间切换，按<span style="color:#ff0000;">两下</span>快捷键 <span style="color:#ff0000;">Ctrl+w</span>&nbsp;即可。<br />
缺点：当一行内容超长的时候，即使开启了自动换行，在一行内跳转也是极不方便的，而且鼠标又不能滚动文本，我觉得不爽。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;code --diff：基于VSCode的左右双屏对比<br />
什么？你天天使用的VSCode也能用做 diff&nbsp;工具？没错：<br />
<span style="color:#ff0000;">code --diff file1 file2</span><br />
这样就能在VSCode编辑器里展示出两个文件的 diff&nbsp;啦：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="VSCode diff" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_6_vscode.png" style="width: 800px; height: 434px;" /></a><br />
如果你想修改diff显示的颜色，你甚至可以修改VSCode的配置(settings.json)来实现：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="json language-json hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;workbench.colorCustomizations&quot;</span>:&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(165, 218, 45); word-wrap: inherit !important; word-break: inherit !important;">&quot;diffEditor.insertedTextBackground&quot;</span>:&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;#fc00ce7c&quot;</span>,
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(165, 218, 45); word-wrap: inherit !important; word-break: inherit !important;">&quot;diffEditor.removedTextBackground&quot;</span>:&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;#4542f97c&quot;</span>,
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(165, 218, 45); word-wrap: inherit !important; word-break: inherit !important;">&quot;diffEditor.insertedLineBackground&quot;</span>:&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;#d9f4db66&quot;</span>,
&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-attr" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(165, 218, 45); word-wrap: inherit !important; word-break: inherit !important;">&quot;diffEditor.removedLineBackground&quot;</span>:&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;#e6dbe066&quot;</span>,
}
</code></pre>
</section>
<p>在这个例子中，workbench.colorCustomizations&nbsp;里的配置都是我添加的。<br />
diffEditor.insertedTextBackground&nbsp;配置的是 file1&nbsp;里的diff内容的颜色；<br />
diffEditor.removedTextBackground&nbsp;配置的是 file2&nbsp;里的diff内容的颜色；<br />
diffEditor.insertedLineBackground&nbsp;配置的是 file1&nbsp;里的diff行的背景色；<br />
diffEditor.removedLineBackground&nbsp;配置的是 file2&nbsp;里的diff行的背景色。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;Meld：图形化的双屏/三屏diff对比工具<br />
MacOS下的<a href="https://yousseb.github.io/meld/" rel="noopener" target="_blank">Meld</a>是另一个图形化diff工具。这个软件类似于Linux下的 meld&nbsp;软件，它不仅可以对比两个文件的 diff，还可以对比三个文件的diff。<br />
不过我在M2 CPU的MacOS上用起来，时不时会crash一次，所以就不想再用了。<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="Meld" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_4_meld.png" style="width: 800px; height: 429px;" /></a><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;超长文本行的diff高亮显示<br />
上面提到的命令行的diff工具，在遇到超长文本行+某些内容的时候，在显示diff的时候都有这样那样的问题。<br />
例如，file1 的第一行和 file2 的第一行都有一万个字符，但它们仅仅在其中的5个字符有差异，那么diff工具理论上应该高亮显示出那5个字符。<br />
但实际上，当这行的内容有些特殊的时候，命令行diff工具可能会高亮显示出整行，而不是那5个字符；或者高亮显示的是多于那5个字符的一块区域。总之它有可能没法精确地标识出diff的部分。<br />
这里举一个例子：<br />
1.txt 和 2.txt 的第一行都超长，它们只在几个字符上有差异：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="VSCode diff long line" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_7_vscode_deal_with_long_line.png" style="width: 800px; height: 44px;" /></a><br />
可见VSCode正确地只高亮了有差异的部分。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
如果用 icdiff 1.txt 2.txt 来查看差异，就非常扯蛋了，它没能像VSCode一样仅标识出diff的部分，而是把整行都标识成了diff，辣眼睛：<br />
<a href="https://www.codelast.com/" rel="noopener" target="_blank"><img decoding="async" alt="icdiff deal with long line" src="https://www.codelast.com/wp-content/uploads/2024/01/mac_os_diff_tool_8_icdiff_deal_with_long_line.png" style="width: 800px; height: 322px;" /></a></p>
<p>在这种情况下，VSCode和Meld都可以正确标识出diff的内容。<br />
所以图形化diff工具还是有用的，别只迷信命令行。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：<br />
<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8b%e7%9a%84%e9%82%a3%e4%ba%9bdiff%e5%b7%a5%e5%85%b7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] MacOS上的Homebrew记录</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8a%e7%9a%84homebrew%e8%ae%b0%e5%bd%95/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8a%e7%9a%84homebrew%e8%ae%b0%e5%bd%95/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 20 Jan 2024 16:52:09 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[软件包管理]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=14050</guid>

					<description><![CDATA[<p>本文记录了MacOS上的软件包管理器Homebrew的若干琐事。</p>
<blockquote>
<p>
		Homebrew 是一个自由和开源的软件包管理系统，专为 macOS 设计，用于简化软件安装过程。它允许用户容易地安装、更新和卸载各种软件包，包括命令行工具、开发工具和常用库。Homebrew 通过 GitHub 维护，并且它的软件包是从 GitHub 仓库中获取的。</p>
</blockquote>
<p><span id="more-14050"></span><br />
<span style="color: rgb(255, 0, 0);">➤</span>&#160;安装 Homebrew 并保持最新<br />
在macOS里，为了方便快捷地安装各种软件包，首先你要装好Homebrew。<br />
安装Homebrew的过程此处不赘述，请参考Homebrew官网。<br />
如果你早已安装过，那么注意要保持它最新：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&#160;update
</code></pre>
</section>
<p>这个过程可能耗时较长。<br />
如果你不更新，可能会在用 brew install xxx&#160;安装软件包的时候，看到类似于下面的提示：</p>
<blockquote>
<div>
		==&#62; Searching for similarly named formulae...</div>
<div>
		Error: No similarly named formulae found.</div>
<div>
		Error: No available formula or cask with the name &#34;grc&#34;.</div></blockquote>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8a%e7%9a%84homebrew%e8%ae%b0%e5%bd%95/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>本文记录了MacOS上的软件包管理器Homebrew的若干琐事。</p>
<blockquote>
<p>
		Homebrew 是一个自由和开源的软件包管理系统，专为 macOS 设计，用于简化软件安装过程。它允许用户容易地安装、更新和卸载各种软件包，包括命令行工具、开发工具和常用库。Homebrew 通过 GitHub 维护，并且它的软件包是从 GitHub 仓库中获取的。</p>
</blockquote>
<p><span id="more-14050"></span><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;安装 Homebrew 并保持最新<br />
在macOS里，为了方便快捷地安装各种软件包，首先你要装好Homebrew。<br />
安装Homebrew的过程此处不赘述，请参考Homebrew官网。<br />
如果你早已安装过，那么注意要保持它最新：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;update
</code></pre>
</section>
<p>这个过程可能耗时较长。<br />
如果你不更新，可能会在用 brew install xxx&nbsp;安装软件包的时候，看到类似于下面的提示：</p>
<blockquote>
<div>
		==&gt; Searching for similarly named formulae...</div>
<div>
		Error: No similarly named formulae found.</div>
<div>
		Error: No available formula or cask with the name &quot;grc&quot;.</div>
<div>
		==&gt; Searching for a previously deleted formula (in the last month)...</div>
<div>
		Error: No previously deleted formula found.</div>
<div>
		==&gt; Searching taps on GitHub...</div>
<div>
		Error: No formulae found in taps.</div>
</blockquote>
<div>
	也就是说Homebrew找不到软件包。</div>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;设置 GitHub&nbsp;密钥，让Homebrew可以正常安装软件<br />
如果你没有设置过 GitHub&nbsp;密钥，当你执行 brew install xxx&nbsp;命令来安装软件的时候，会报错：</p>
<blockquote>
<div>
		Error: GitHub</div>
<div>
		The GitHub credentials in the macOS keychain may be invalid.</div>
<div>
		Clear them with:</div>
<div>
		&nbsp; printf &quot;protocol=https\nhost=github.com\n&quot; | git credential-osxkeychain erase</div>
<div>
		Or create a personal access token:</div>
<div>
		&nbsp; https://github.com/settings/tokens/new?scopes=gist,public_repo&amp;description=Homebrew</div>
<div>
		and then set the token as: export HOMEBREW_GITHUB_API_TOKEN=&quot;your_new_token&quot;</div>
</blockquote>
<p>大概意思就是，你需要到上面的这个GitHub链接里设置、生成一个token，然后把&nbsp;<span style="color: rgb(0, 0, 255);">HOMEBREW_GITHUB_API_TOKEN</span>&nbsp;这个环境变量设置成你生成的那个token。<br />
照做就得了。生成token之后，编辑&nbsp;~/.bash_profile&nbsp;文件，添加一行：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); overflow-wrap: inherit !important; word-break: inherit !important;">export</span>&nbsp;HOMEBREW_GITHUB_API_TOKEN=xxx
</code></pre>
</section>
<p>其中，xxx&nbsp;代表你在GitHub上生成的那个 token。<br />
这样做之后，你理应可以用 brew install&nbsp;来正常安装软件了。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤</span>&nbsp;Homebrew加速：设置国内镜像<br />
由于Homebrew默认使用的是GitHub上的仓库，对于国内用户来说，访问速度可能会比较慢。国内有一些机构提供了Homebrew的镜像，可以用来加速软件包的下载和安装：中科大镜像、清华镜像、阿里云镜像等。<br />
以阿里云镜像为例：<br />
替换 brew.git：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">git&nbsp;-C&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); overflow-wrap: inherit !important; word-break: inherit !important;">&quot;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); overflow-wrap: inherit !important; word-break: inherit !important;">$(brew&nbsp;--repo)</span>&quot;</span>&nbsp;remote&nbsp;<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); overflow-wrap: inherit !important; word-break: inherit !important;">set</span>-url&nbsp;origin&nbsp;https://mirrors.aliyun.com/homebrew/brew.git
</code></pre>
</section>
<p>替换&nbsp;homebrew-core.git：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">git&nbsp;-C&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); overflow-wrap: inherit !important; word-break: inherit !important;">&quot;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); overflow-wrap: inherit !important; word-break: inherit !important;">$(brew&nbsp;--repo&nbsp;homebrew/core)</span>&quot;</span>&nbsp;remote&nbsp;<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); overflow-wrap: inherit !important; word-break: inherit !important;">set</span>-url&nbsp;origin&nbsp;https://mirrors.aliyun.com/homebrew/homebrew-core.git
</code></pre>
</section>
<p>替换&nbsp;homebrew-cask.git（如果需要）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; letter-spacing: 0px; color: rgb(62, 62, 62); line-height: 1.6; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="padding: 0px; font-size: inherit; width: 1066.23px; margin-top: 0px; margin-bottom: 0px; color: inherit; line-height: inherit;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">git&nbsp;-C&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); overflow-wrap: inherit !important; word-break: inherit !important;">&quot;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); overflow-wrap: inherit !important; word-break: inherit !important;">$(brew&nbsp;--repo&nbsp;homebrew/cask)</span>&quot;</span>&nbsp;remote&nbsp;<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); overflow-wrap: inherit !important; word-break: inherit !important;">set</span>-url&nbsp;origin&nbsp;https://mirrors.aliyun.com/homebrew/homebrew-cask.git
</code></pre>
</section>
<p>然后再执行 brew update&nbsp;来更新本地仓库。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：<br />
<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e4%b8%8a%e7%9a%84homebrew%e8%ae%b0%e5%bd%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] MacOS的ssh命令报错：Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e7%9a%84ssh%e5%91%bd%e4%bb%a4%e6%8a%a5%e9%94%99%ef%bc%9alibrary-not-loaded-usr-local-opt-openssl-lib-libcrypto-1-0-0-dylib/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e7%9a%84ssh%e5%91%bd%e4%bb%a4%e6%8a%a5%e9%94%99%ef%bc%9alibrary-not-loaded-usr-local-opt-openssl-lib-libcrypto-1-0-0-dylib/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Fri, 19 Jan 2024 19:42:17 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Library not loaded]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssh]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=14021</guid>

					<description><![CDATA[<p>MacOS执行一个连接远程服务器的命令 <span style="color:#b22222;">ssh root@192.168.10.78 &#34;mkdir -p /data&#34;</span> 命令时，报错：</p>
<blockquote>
<div>
		dyld[52840]: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib</div>
<div>
		&#160; Referenced from: &#60;此处内容省略&#62; /usr/local/Cellar/openssh/7.8p1/bin/ssh</div>
<div>
		&#160; Reason: tried: &#39;/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/lib/libcrypto.1.0.0.dylib&#39; (no such file, not in dyld cache), &#39;/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.1.0.0.dylib&#39;</div></blockquote>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e7%9a%84ssh%e5%91%bd%e4%bb%a4%e6%8a%a5%e9%94%99%ef%bc%9alibrary-not-loaded-usr-local-opt-openssl-lib-libcrypto-1-0-0-dylib/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>MacOS执行一个连接远程服务器的命令 <span style="color:#b22222;">ssh root@192.168.10.78 &quot;mkdir -p /data&quot;</span> 命令时，报错：</p>
<blockquote>
<div>
		dyld[52840]: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib</div>
<div>
		&nbsp; Referenced from: &lt;此处内容省略&gt; /usr/local/Cellar/openssh/7.8p1/bin/ssh</div>
<div>
		&nbsp; Reason: tried: &#39;/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/lib/libcrypto.1.0.0.dylib&#39; (no such file, not in dyld cache), &#39;/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/Cellar/openssl@3/3.2.0_1/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/local/lib/libcrypto.1.0.0.dylib&#39; (no such file), &#39;/usr/lib/libcrypto.1.0.0.dylib&#39; (no such file, not in dyld cache)</div>
</blockquote>
<div>
	这个问题可能是因为<span style="color:#0000ff;">OpenSSH</span>版本旧导致的。可以尝试更新<span style="color:#0000ff;">OpenSSH</span>来解决：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;update
brew&nbsp;upgrade&nbsp;openssh
</code></pre>
</section>
<p>重试，如果仍然报错，可能要尝试重新安装OpenSSH了：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;">brew&nbsp;uninstall&nbsp;--ignore-dependencies&nbsp;openssh
brew&nbsp;install&nbsp;openssh
</code></pre>
</section>
<p>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：<br />
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
	以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
		<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-macos%e7%9a%84ssh%e5%91%bd%e4%bb%a4%e6%8a%a5%e9%94%99%ef%bc%9alibrary-not-loaded-usr-local-opt-openssl-lib-libcrypto-1-0-0-dylib/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 如何下载HLS流视频文件</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdhls%e6%b5%81%e8%a7%86%e9%a2%91%e6%96%87%e4%bb%b6/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdhls%e6%b5%81%e8%a7%86%e9%a2%91%e6%96%87%e4%bb%b6/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Wed, 03 May 2023 10:12:39 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[下载HLS]]></category>
		<category><![CDATA[下载m3u8]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=13899</guid>

					<description><![CDATA[<p>在互联网上，有些视频以HLS流的形式呈现，当你用一些工具捕获到它的播放地址时，会发现是一个以 .m3u8&#160;结尾的URL。<br />
那么，什么是 HLS&#160;和&#160;m3u8&#160;呢？</p>
<blockquote>
<p>
		HLS（HTTP Live Streaming）是一种基于HTTP协议的流媒体传输协议，而M3U8则是一种基于文本的播放列表文件格式。在HLS中，媒体数据被划分成多个小文件进行传输，并使用M3U8文件作为索引来指向这些媒体数据文件。M3U8文件包含了所有的媒体数据文件的URL地址及其相关信息，如码率、分辨率、编码格式等。因此，当一个客户端请求播放一个HLS流时，它将下载对应的M3U8索引文件，并且根据其中包含的地址去下载其他的媒体数据文件。简单来说，HLS和M3U8是两个不同但紧密相连的概念，其中M3U8作为HLS协议中索引与定位资源的重要组成部分。</p>
</blockquote>
<p>问题来了：如何下载HLS流视频文件呢？<br />
<span id="more-13899"></span><br />
有多种方法，下面略举一二。</p>
<p><span style="background-color: rgb(0, 255, 0);">➤</span>&#160;使用Chrome插件：<span style="color:#0000ff;">Video DownloadHelper</span><br />
这个插件可以捕获视频地址，也可以直接下载。但是直接下载HLS流视频每天有次数限制（很久以前是这样，不知道现在是什么情况），所以用此插件直接下载不可取。<br />
那么我们可以用它获取视频地址，再用类似于 <a href="https://github.com/HeiSir2014/M3U8-Downloader" rel="noopener" target="_blank">M3U8-Downloader</a>&#160;这样的桌面软件去下载这个地址指向的视频。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">➤</span>&#160;使用跨平台的HLS下载工具&#160;<span style="color:#0000ff;">N_m3u8DL-RE</span><br />
<a href="https://github.com/nilaoda/N_m3u8DL-RE" rel="noopener" target="_blank">N_m3u8DL-RE</a>&#160;是一款跨平台的DASH/HLS/MSS下载工具，功能很强大。<br />
以Ubuntu Linux系统为例，只需简单地下载其release包，解压出来得到一个可执行程序&#160;N_m3u8DL-RE，然后这样用就可以下载HLS流视频了：</p>
<blockquote>
<p>
		./N_m3u8DL-RE &#60;m3u8_url&#62;</p>
</blockquote>
<p>N_m3u8DL-RE&#160;支持的参数非常多，可以参考其文档。<br />
如果首次运行的时候提示没有安装 ffmpeg，可以用 apt install ffmpeg&#160;安装，再运行。</p>
<p>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;版权声明&#160;<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdhls%e6%b5%81%e8%a7%86%e9%a2%91%e6%96%87%e4%bb%b6/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>在互联网上，有些视频以HLS流的形式呈现，当你用一些工具捕获到它的播放地址时，会发现是一个以 .m3u8&nbsp;结尾的URL。<br />
那么，什么是 HLS&nbsp;和&nbsp;m3u8&nbsp;呢？</p>
<blockquote>
<p>
		HLS（HTTP Live Streaming）是一种基于HTTP协议的流媒体传输协议，而M3U8则是一种基于文本的播放列表文件格式。在HLS中，媒体数据被划分成多个小文件进行传输，并使用M3U8文件作为索引来指向这些媒体数据文件。M3U8文件包含了所有的媒体数据文件的URL地址及其相关信息，如码率、分辨率、编码格式等。因此，当一个客户端请求播放一个HLS流时，它将下载对应的M3U8索引文件，并且根据其中包含的地址去下载其他的媒体数据文件。简单来说，HLS和M3U8是两个不同但紧密相连的概念，其中M3U8作为HLS协议中索引与定位资源的重要组成部分。</p>
</blockquote>
<p>问题来了：如何下载HLS流视频文件呢？<br />
<span id="more-13899"></span><br />
有多种方法，下面略举一二。</p>
<p><span style="background-color: rgb(0, 255, 0);">➤</span>&nbsp;使用Chrome插件：<span style="color:#0000ff;">Video DownloadHelper</span><br />
这个插件可以捕获视频地址，也可以直接下载。但是直接下载HLS流视频每天有次数限制（很久以前是这样，不知道现在是什么情况），所以用此插件直接下载不可取。<br />
那么我们可以用它获取视频地址，再用类似于 <a href="https://github.com/HeiSir2014/M3U8-Downloader" rel="noopener" target="_blank">M3U8-Downloader</a>&nbsp;这样的桌面软件去下载这个地址指向的视频。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">➤</span>&nbsp;使用跨平台的HLS下载工具&nbsp;<span style="color:#0000ff;">N_m3u8DL-RE</span><br />
<a href="https://github.com/nilaoda/N_m3u8DL-RE" rel="noopener" target="_blank">N_m3u8DL-RE</a>&nbsp;是一款跨平台的DASH/HLS/MSS下载工具，功能很强大。<br />
以Ubuntu Linux系统为例，只需简单地下载其release包，解压出来得到一个可执行程序&nbsp;N_m3u8DL-RE，然后这样用就可以下载HLS流视频了：</p>
<blockquote>
<p>
		./N_m3u8DL-RE &lt;m3u8_url&gt;</p>
</blockquote>
<p>N_m3u8DL-RE&nbsp;支持的参数非常多，可以参考其文档。<br />
如果首次运行的时候提示没有安装 ffmpeg，可以用 apt install ffmpeg&nbsp;安装，再运行。</p>
<p>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：<br />
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
	以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdhls%e6%b5%81%e8%a7%86%e9%a2%91%e6%96%87%e4%bb%b6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[AI] 怎样开发一个最简单的 iOS App</title>
		<link>https://www.codelast.com/ai-%e6%80%8e%e6%a0%b7%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84-ios-app/</link>
					<comments>https://www.codelast.com/ai-%e6%80%8e%e6%a0%b7%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84-ios-app/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Thu, 23 Mar 2023 18:19:39 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[iOS App]]></category>
		<category><![CDATA[开发]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=13859</guid>

					<description><![CDATA[<p>要开发一个最简单的iOS应用程序，您需要了解一些基本的编程知识和工具。这是一些步骤：</p>
<p>1. 下载并安装Xcode：这是苹果公司提供的集成开发环境（IDE），可用于创建iOS应用程序。您可以从Mac App Store免费下载Xcode。&#160;</p>
<p>2. 学习Swift或Objective-C：这些是iOS应用程序开发中最常用的编程语言。每种语言都有其特定的语法和规则，需要花费一些时间来学习。&#160;<br />
<span id="more-13859"></span><br />
3. 创建新项目：打开Xcode，选择&#8220;File&#8221;&#62;&#8220;New&#8221;&#62;&#8220;Project&#8221;。然后选择&#8220;Single View Application&#8221;，输入您的项目名称和组织标识符，并选择其他选项，例如存储位置等。&#160;</p>
<p>4. 构建用户界面：使用Xcode提供的Interface Builder工具创建用户界面元素，例如按钮、文本字段、标签等。&#160;</p>
<p>5. 实现功能逻辑：在ViewController.swift或ViewController.m文件中实现应用程序逻辑。例如，在按钮点击时执行某个操作等。&#160;</p>
<p>6. 运行应用程序：使用模拟器或连接到实际设备运行应用程序，并测试其功能。&#160;</p>
<p>以上是一个大致的步骤来创建一个最简单的iOS应用程序。当然还有非常多的细节需要了解和掌握，但这可以作为您开始学习iOS开发的起点。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;关注不迷路&#160;<span style="color: rgb(255, 0, 0);">➤➤</span>&#160;</p>
<p>
	感谢关注我的微信公众号（微信扫一扫）：<br />
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
	以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" />&#8230; <a href="https://www.codelast.com/ai-%e6%80%8e%e6%a0%b7%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84-ios-app/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>要开发一个最简单的iOS应用程序，您需要了解一些基本的编程知识和工具。这是一些步骤：</p>
<p>1. 下载并安装Xcode：这是苹果公司提供的集成开发环境（IDE），可用于创建iOS应用程序。您可以从Mac App Store免费下载Xcode。&nbsp;</p>
<p>2. 学习Swift或Objective-C：这些是iOS应用程序开发中最常用的编程语言。每种语言都有其特定的语法和规则，需要花费一些时间来学习。&nbsp;<br />
<span id="more-13859"></span><br />
3. 创建新项目：打开Xcode，选择&ldquo;File&rdquo;&gt;&ldquo;New&rdquo;&gt;&ldquo;Project&rdquo;。然后选择&ldquo;Single View Application&rdquo;，输入您的项目名称和组织标识符，并选择其他选项，例如存储位置等。&nbsp;</p>
<p>4. 构建用户界面：使用Xcode提供的Interface Builder工具创建用户界面元素，例如按钮、文本字段、标签等。&nbsp;</p>
<p>5. 实现功能逻辑：在ViewController.swift或ViewController.m文件中实现应用程序逻辑。例如，在按钮点击时执行某个操作等。&nbsp;</p>
<p>6. 运行应用程序：使用模拟器或连接到实际设备运行应用程序，并测试其功能。&nbsp;</p>
<p>以上是一个大致的步骤来创建一个最简单的iOS应用程序。当然还有非常多的细节需要了解和掌握，但这可以作为您开始学习iOS开发的起点。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;关注不迷路&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;</p>
<p>
	感谢关注我的微信公众号（微信扫一扫）：<br />
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="color: rgb(77, 77, 77); font-size: 13px; width: 200px; height: 200px;" /><br />
	以及我的微信视频号：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="" src="https://www.codelast.com/wechat_shipinhao_qr_code.jpg" style="text-align: center; width: 200px; height: 199px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/ai-%e6%80%8e%e6%a0%b7%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e6%9c%80%e7%ae%80%e5%8d%95%e7%9a%84-ios-app/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 推荐一款编写数学公式的国产神器：AxMath，可与LATEX双向转换</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%8e%a8%e8%8d%90%e4%b8%80%e6%ac%be%e7%bc%96%e5%86%99%e6%95%b0%e5%ad%a6%e5%85%ac%e5%bc%8f%e7%9a%84%e5%9b%bd%e4%ba%a7%e7%a5%9e%e5%99%a8%ef%bc%9aaxmath%ef%bc%8c%e5%8f%af%e4%b8%8ela/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%8e%a8%e8%8d%90%e4%b8%80%e6%ac%be%e7%bc%96%e5%86%99%e6%95%b0%e5%ad%a6%e5%85%ac%e5%bc%8f%e7%9a%84%e5%9b%bd%e4%ba%a7%e7%a5%9e%e5%99%a8%ef%bc%9aaxmath%ef%bc%8c%e5%8f%af%e4%b8%8ela/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sun, 25 Oct 2020 00:31:32 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[AxMath]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[MathType]]></category>
		<category><![CDATA[数学公式]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=13059</guid>

					<description><![CDATA[<div>
	<img decoding="async" alt="latex" src="https://www.codelast.com/wp-content/uploads/2020/10/latex.png" style="width: 300px; height: 144px;" /></div>
<p>我一直都很佩服那些可以直接用LATEX语法打出各种复杂数学公式的人，反正我是记不住，而且也真的不想去记LATEX语法。<br />
比如这个公式：<br />
<img decoding="async" alt="cauchy's inequality" src="https://www.codelast.com/wp-content/uploads/2020/10/cauchy_inequality.png" style="width: 500px; height: 91px;" /></p>
<p>有的人能直接用LATEX手写出来：<br />
<span style="color:#0000ff;">\left( \sum_{i=1}^n{a_ib_i} \right) ^2\leqslant \left( \sum_{i=1}^n{a_{i}^{2}} \right) \left( \sum_{i=1}^n{b_{i}^{2}} \right) , a_i,b_i\in \mathbb{R}</span><br />
这还算简单的了，更复杂的公式大神们都可以直接手写LATEX。<br />
就问你服不服。<br />
在下自愧脑容量不足。<br />
所以当我要输入数学公式的时候，MathType这个功能强大的可视化数学公式编辑器就是我认为最方便易用的软件。<br />
<span id="more-13059"></span></p>
<div>
	<img decoding="async" alt="mathtype" src="https://www.codelast.com/wp-content/uploads/2020/10/mathtype_logo.png" style="width: 225px; height: 225px;" /></div>
<p><span style="color: rgb(0, 0, 255);">▶</span>&#160;MathType的方便之处<br />
MathType可以直接在复制图形界面的公式的时候，就把公式自动转换成LATEX语法再复制到内存里，粘贴的时候直接粘贴出来LATEX。比如我的网站里面的数学公式，在后台的文字编辑界面里大部分都是LATEX，但它们并不是我用手输的，而是用软件转换成LATEX再粘贴上来的（参考<a href="https://www.codelast.com/?p=6199" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接）。<br />
<img decoding="async" alt="mathtype convert latex" src="http://www.codelast.com/wp-content/uploads/ckfinder/images/mathtype_setting_convert.png" style="width: 285px; height: 255px;" /><br />
<span style="color: rgb(0, 0, 255);">▶</span>&#160;MathType的缺点<br />
但它有个缺点就是：贵。正版的单用户授权要300～400元。这个价格对大多数人来说都是要割肉的。<br />
<span style="color: rgb(0, 0, 255);">▶</span>&#160;MathType官方的雷人开发效率<br />
而且当前最新版的MathType 7在当前最新版的<span style="color:#800080;">MacOS Catalina</span>系统上无法运行（官方通告<a href="https://lp.wiris.com/catalina/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">在此</span></a>）。官方说会在2020年发布新版MathType解决此问题，一个导致产品完全无法使用的P0级问题出现那么久了，开发商还没有解决问题，其效率之低，令人侧目。仗着自己是世界范围内同类软件的老大，可以无视用户对吧？<br />
<!--more--><br />
<span style="color: rgb(0, 0, 255);">▶</span>&#160;MathType有什么替代软件吗？<br />
首先是你能搜到很多&#8220;网页版&#8221;的数学公式编辑器，但我得说，我也用过很多个，一个真●能打的都没有，它们比MathType用起来麻烦多了，而且功能弱。</p>
<p>直到我遇到了<a href="https://www.amyxun.com/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">AxMath</span></a>，一款国产的&#8220;仿MathType&#8221;软件(但在很多方面已经超越了MathType)，我才知道原来这种国产软件也可以做得这么精良，而且单用户单机正版授权才30多块钱，童叟无欺，一顿饭的钱就能买这么强大的正版软件，你买不了吃亏买不了上当！<br />
<img decoding="async" alt="axmath" src="https://www.codelast.com/wp-content/uploads/2020/10/axmath_logo.png" style="width: 300px; height: 244px;" /><br />
如果不买正版授权也是可以试用的，不过不能复制粘贴你输入的公式。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%8e%a8%e8%8d%90%e4%b8%80%e6%ac%be%e7%bc%96%e5%86%99%e6%95%b0%e5%ad%a6%e5%85%ac%e5%bc%8f%e7%9a%84%e5%9b%bd%e4%ba%a7%e7%a5%9e%e5%99%a8%ef%bc%9aaxmath%ef%bc%8c%e5%8f%af%e4%b8%8ela/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<div>
	<img decoding="async" alt="latex" src="https://www.codelast.com/wp-content/uploads/2020/10/latex.png" style="width: 300px; height: 144px;" /></div>
<p>我一直都很佩服那些可以直接用LATEX语法打出各种复杂数学公式的人，反正我是记不住，而且也真的不想去记LATEX语法。<br />
比如这个公式：<br />
<img decoding="async" alt="cauchy's inequality" src="https://www.codelast.com/wp-content/uploads/2020/10/cauchy_inequality.png" style="width: 500px; height: 91px;" /></p>
<p>有的人能直接用LATEX手写出来：<br />
<span style="color:#0000ff;">\left( \sum_{i=1}^n{a_ib_i} \right) ^2\leqslant \left( \sum_{i=1}^n{a_{i}^{2}} \right) \left( \sum_{i=1}^n{b_{i}^{2}} \right) , a_i,b_i\in \mathbb{R}</span><br />
这还算简单的了，更复杂的公式大神们都可以直接手写LATEX。<br />
就问你服不服。<br />
在下自愧脑容量不足。<br />
所以当我要输入数学公式的时候，MathType这个功能强大的可视化数学公式编辑器就是我认为最方便易用的软件。<br />
<span id="more-13059"></span></p>
<div>
	<img decoding="async" alt="mathtype" src="https://www.codelast.com/wp-content/uploads/2020/10/mathtype_logo.png" style="width: 225px; height: 225px;" /></div>
<p><span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;MathType的方便之处<br />
MathType可以直接在复制图形界面的公式的时候，就把公式自动转换成LATEX语法再复制到内存里，粘贴的时候直接粘贴出来LATEX。比如我的网站里面的数学公式，在后台的文字编辑界面里大部分都是LATEX，但它们并不是我用手输的，而是用软件转换成LATEX再粘贴上来的（参考<a href="https://www.codelast.com/?p=6199" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这个</span></a>链接）。<br />
<img decoding="async" alt="mathtype convert latex" src="http://www.codelast.com/wp-content/uploads/ckfinder/images/mathtype_setting_convert.png" style="width: 285px; height: 255px;" /><br />
<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;MathType的缺点<br />
但它有个缺点就是：贵。正版的单用户授权要300～400元。这个价格对大多数人来说都是要割肉的。<br />
<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;MathType官方的雷人开发效率<br />
而且当前最新版的MathType 7在当前最新版的<span style="color:#800080;">MacOS Catalina</span>系统上无法运行（官方通告<a href="https://lp.wiris.com/catalina/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">在此</span></a>）。官方说会在2020年发布新版MathType解决此问题，一个导致产品完全无法使用的P0级问题出现那么久了，开发商还没有解决问题，其效率之低，令人侧目。仗着自己是世界范围内同类软件的老大，可以无视用户对吧？<br />
<!--more--><br />
<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;MathType有什么替代软件吗？<br />
首先是你能搜到很多&ldquo;网页版&rdquo;的数学公式编辑器，但我得说，我也用过很多个，一个真●能打的都没有，它们比MathType用起来麻烦多了，而且功能弱。</p>
<p>直到我遇到了<a href="https://www.amyxun.com/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">AxMath</span></a>，一款国产的&ldquo;仿MathType&rdquo;软件(但在很多方面已经超越了MathType)，我才知道原来这种国产软件也可以做得这么精良，而且单用户单机正版授权才30多块钱，童叟无欺，一顿饭的钱就能买这么强大的正版软件，你买不了吃亏买不了上当！<br />
<img decoding="async" alt="axmath" src="https://www.codelast.com/wp-content/uploads/2020/10/axmath_logo.png" style="width: 300px; height: 244px;" /><br />
如果不买正版授权也是可以试用的，不过不能复制粘贴你输入的公式。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;AxMath的局限性<br />
只支持Windows系统（不像MathType有Mac版的）。不过这也还好，如果电脑是Mac/Linux的话，大不了在Windows虚拟机里运行AxMath，或者用<a href="https://www.codeweavers.com/crossover" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">CrossOver</span></a>跑AxMath（亲测可用）。</p>
<p><span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;AxMath的华丽功能<br />
当你第一眼看到AxMath界面的时候，一定会被它的华丽外观给迷到，简直比MathType高级到不知道到哪里去了！<br />
<img decoding="async" alt="axmath ui" src="https://www.codelast.com/wp-content/uploads/2020/10/axmath_ui_1.png" style="width: 600px; height: 761px;" /><br />
看看它支持输入的数学符号有多少种，简直多到像满天星。<br />
官网上的那些强大功能介绍我就不粘贴过来了，我只说几个我肤浅使用了之后感觉特别好的地方。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color:#b22222;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;可以自定义复制出来的LATEX的起始、结束符号<br />
举个例子。<br />
在MatyType里，复制一个数学公式 <span class='MathJax_Preview'><img src='https://www.codelast.com/wp-content/plugins/latex/cache/tex_3a8d8ec90ca2d552f7f63b3627032a7b.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="y=ax+b" /></span><script type='math/tex'>y=ax+b</script> ，再粘贴到任意文本编辑器里，得到的内容如下：<br />
<span style="color:#0000ff;">\ [y=ax+b\ ]</span><br />
开头、结尾的 <span style="color:#ff0000;">\ [</span> 和 <span style="color:#ff0000;">\ ]&nbsp;</span>是不能在MathType中自定义的。当我在网站后台编辑器里用LATEX写数学公式时，这两个开头、结尾的符号要人工修改成 <span style="color:#ff0000;">\ (</span>&nbsp;和 <span style="color:#ff0000;">\ )</span>（&rarr;我特意在这些标成红色的符号之间都多加了一个空格以避免它们显示为数学公式），否则就会被LaTeX for WordPress插件解释成&ldquo;换行居中&rdquo;的式样，从而导致文章排版有问题，我在<a href="https://www.codelast.com/?p=6199" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这篇文章</span></a>里已经做了详细的解释。<br />
每次在MathType里复制公式时，都要做这个重复的人工活，心累。<br />
AxMath就没有这种问题，因为它可以设置&ldquo;<span style="color:#0000ff;">语法定界符</span>&rdquo;，也就是上面说的LATEX开头、结尾的符号。设置成&nbsp;<span style="color: rgb(255, 0, 0);">\ (</span>&nbsp;和&nbsp;<span style="color: rgb(255, 0, 0);">\ )&nbsp;</span>就解决问题啦！<br />
<img decoding="async" alt="axmath settings" src="https://www.codelast.com/wp-content/uploads/2020/10/axmath_settings.jpg" style="width: 476px; height: 475px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(178, 34, 34);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;没有MathType经常&ldquo;多生成一个空格&rdquo;的问题<br />
举个例子。<br />
在MathType中用图形界面输入以下公式：<br />
<img decoding="async" alt="math function" src="https://www.codelast.com/wp-content/uploads/2020/10/math_function_1.png" style="width: 657px; height: 92px;" /><br />
复制，粘贴到文本编辑器中，变成了：<br />
<span style="color:#0000ff;">\ [{V_\pi }(s) = {E_{{s^{(1)}}, \cdots }}\left( {\sum\limits_{t = 0}^\infty&nbsp; {{\gamma ^t}R({s^{(t)}},\pi ({s^{(t)}}),{s^{(t + 1)}})\left| {{s^{(0)}} = s;\pi } \right.} } \right) \ ]</span><br />
注意：<span style="color:#b22222;">为了让上面的LATEX显示为纯文本，而不是被我网站里的LaTeX for WordPress插件渲染成数学公式展现出来，我特意在开头的&nbsp;</span><span style="color: rgb(0, 0, 255);">\</span><span style="color:#b22222;">&nbsp;符号后面、以及结尾的&nbsp;</span><span style="color: rgb(0, 0, 255);">]</span><span style="color:#b22222;">&nbsp;符号前面分别都加了一个空格（实际上复制出来的LATEX是没有这两个空格的）</span>。<br />
这个LATEX被我网站里的LaTeX for WordPress插件渲染成了这样：<br />
<img decoding="async" alt="math function" src="https://www.codelast.com/wp-content/uploads/2020/10/math_function_1_with_problem.png" style="width: 535px; height: 79px;" /><br />
注意看中间有一个奇怪的问号，是个什么鬼？<br />
这就是MathType的一个缺陷了（不知道算不算bug）。原因是在  <span class='MathJax_Preview'><img src='https://www.codelast.com/wp-content/plugins/latex/cache/tex_334de1ea38b615839e4ee6b65ee1b103.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="\gamma " /></span><script type='math/tex'>\gamma </script>  字母的前面，MathType生成了两个空格（&nbsp;<span style="color: rgb(0, 0, 255);">infty&nbsp; {{\gamma&nbsp;</span>），而不是正确的一个空格。<br />
注意看这个小细节。在我的使用过程中，MathType经常犯这样的错误，导致我不得不对复制出来的LATEX做人工修正，很烦很烦。<br />
而AxMath就没有这个问题。</p>
<p><span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;结语<br />
AxMath，你值得拥有！</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e6%8e%a8%e8%8d%90%e4%b8%80%e6%ac%be%e7%bc%96%e5%86%99%e6%95%b0%e5%ad%a6%e5%85%ac%e5%bc%8f%e7%9a%84%e5%9b%bd%e4%ba%a7%e7%a5%9e%e5%99%a8%ef%bc%9aaxmath%ef%bc%8c%e5%8f%af%e4%b8%8ela/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 配置iTerm2(MacOS)的&quot;站点管理器&quot;</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 29 Feb 2020 16:27:04 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[iTerm2]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[站点管理器]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=11779</guid>

					<description><![CDATA[<p>
很多terminal client都有&#8220;站点管理器&#8221;功能，也就是说把服务器连接参数保存在配置里，用户可以通过在图形界面上点击的方式就能连接上指定的服务器，不再需要手工输入服务器IP、用户名、密码。<br />
SecureCTR，Xshell，ZOC等都有这种功能，但它们都不是免费软件。<br />
在MacOS上，ZOC算是一个功能很强大的terminal，但其价格也是贵得离谱（2019年的价格是将近80美元/单用户授权），而免费又最流行的terminal&#8212;&#8212;iTerm2，其对&#8220;站点管理器&#8221;的支持却不那么直接，需要经过一定的配置才能用起来，不过，就算是为了省那80美元，也值得我们花一些时间来配置一番，下面就走起来。<br />
<span id="more-11779"></span><br />
<span style="color:#ff0000;"><span style="background-color:#00ff00;">▶</span></span>&#160;分别为每个要连接的服务器创建一个profile<br />
在iTerm2主界面里按 <span style="color:#0000ff;">Command+O</span>&#160;快捷键打开&#8220;Profiles&#8221;对话框，如果你之前没有配置过的话，里面只会看到一个名为&#8220;<span style="color:#b22222;">Default</span>&#8221;的profile。不用管它，点击对话框下方的&#8220;<span style="color:#0000ff;">Edit Profiles...</span>&#8221;按钮：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/02/iterm2_edit_profiles_button.png" style="width: 446px; height: 194px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
会进入&#8220;<span style="color:#0000ff;">Preferences</span>&#8221;对话框：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_1.png" style="width: 300px; height: 541px;" /><br />
点击左下角的&#8220;+&#8221;，添加一个profile：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_2.png" style="width: 650px; height: 389px;" /><br />
其中，&#8220;Name&#8221;随便起一个名字即可；&#8220;Tags&#8221;可以为该服务器设置一个标签，相同标签的服务器可以有一个相同分组的概念；&#8220;Command&#8221;那里在下拉列表框里就选&#8220;Command&#8221;，并且在后面的文本框里填上：</p>
<blockquote>
<p>
		/Users/codelast/iterm-login.sh 22 codelast@abc.com&#160;my_login_password</p>
</blockquote>
<p>其中：<br />
<span style="color:#0000cd;">/Users/codelast/iterm-login.sh&#160;是一个配合登录用的脚本，后面接着会说到它。<br />
22是</span><span style="color:#b22222;">服务器ssh端口号</span><span style="color:#0000cd;">。<br />
codelast@abc.com&#160;是</span><span style="color:#b22222;">服务器ssh用户名</span><span style="color:#0000cd;">@</span><span style="color:#b22222;">服务器域名或IP</span><span style="color:#0000cd;">。<br />
my_login_password&#160;是</span><span style="color:#b22222;">登录服务器的密码</span><span style="color:#0000cd;">。</span><br />
以上内容根据实际情况更改。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;配合iTerm2使用的登录脚本<br />
iterm-login.sh&#160;脚本内容如下（内容来自网上，原链接不记得了，感谢作者）：&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
很多terminal client都有&ldquo;站点管理器&rdquo;功能，也就是说把服务器连接参数保存在配置里，用户可以通过在图形界面上点击的方式就能连接上指定的服务器，不再需要手工输入服务器IP、用户名、密码。<br />
SecureCTR，Xshell，ZOC等都有这种功能，但它们都不是免费软件。<br />
在MacOS上，ZOC算是一个功能很强大的terminal，但其价格也是贵得离谱（2019年的价格是将近80美元/单用户授权），而免费又最流行的terminal&mdash;&mdash;iTerm2，其对&ldquo;站点管理器&rdquo;的支持却不那么直接，需要经过一定的配置才能用起来，不过，就算是为了省那80美元，也值得我们花一些时间来配置一番，下面就走起来。<br />
<span id="more-11779"></span><br />
<span style="color:#ff0000;"><span style="background-color:#00ff00;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;分别为每个要连接的服务器创建一个profile<br />
在iTerm2主界面里按 <span style="color:#0000ff;">Command+O</span>&nbsp;快捷键打开&ldquo;Profiles&rdquo;对话框，如果你之前没有配置过的话，里面只会看到一个名为&ldquo;<span style="color:#b22222;">Default</span>&rdquo;的profile。不用管它，点击对话框下方的&ldquo;<span style="color:#0000ff;">Edit Profiles...</span>&rdquo;按钮：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/02/iterm2_edit_profiles_button.png" style="width: 446px; height: 194px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
会进入&ldquo;<span style="color:#0000ff;">Preferences</span>&rdquo;对话框：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_1.png" style="width: 300px; height: 541px;" /><br />
点击左下角的&ldquo;+&rdquo;，添加一个profile：<br />
<img decoding="async" alt="" src="https://www.codelast.com/wp-content/uploads/2020/03/iterm2_preference_2.png" style="width: 650px; height: 389px;" /><br />
其中，&ldquo;Name&rdquo;随便起一个名字即可；&ldquo;Tags&rdquo;可以为该服务器设置一个标签，相同标签的服务器可以有一个相同分组的概念；&ldquo;Command&rdquo;那里在下拉列表框里就选&ldquo;Command&rdquo;，并且在后面的文本框里填上：</p>
<blockquote>
<p>
		/Users/codelast/iterm-login.sh 22 codelast@abc.com&nbsp;my_login_password</p>
</blockquote>
<p>其中：<br />
<span style="color:#0000cd;">/Users/codelast/iterm-login.sh&nbsp;是一个配合登录用的脚本，后面接着会说到它。<br />
22是</span><span style="color:#b22222;">服务器ssh端口号</span><span style="color:#0000cd;">。<br />
codelast@abc.com&nbsp;是</span><span style="color:#b22222;">服务器ssh用户名</span><span style="color:#0000cd;">@</span><span style="color:#b22222;">服务器域名或IP</span><span style="color:#0000cd;">。<br />
my_login_password&nbsp;是</span><span style="color:#b22222;">登录服务器的密码</span><span style="color:#0000cd;">。</span><br />
以上内容根据实际情况更改。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;配合iTerm2使用的登录脚本<br />
iterm-login.sh&nbsp;脚本内容如下（内容来自网上，原链接不记得了，感谢作者）：</p>
<section class="output_wrapper" id="output_wrapper_id" style="font-size: 16px; color: rgb(62, 62, 62); line-height: 1.6; letter-spacing: 0px; font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;">
<pre style="font-size: inherit; color: inherit; line-height: inherit; margin-top: 0px; margin-bottom: 0px; padding: 0px;">
<code class="bash language-bash hljs" style="margin: 0px 2px; line-height: 18px; font-size: 14px; letter-spacing: 0px; font-family: Consolas, Inconsolata, Courier, monospace; border-radius: 0px; color: rgb(169, 183, 198); background: rgb(40, 43, 46); padding: 0.5em; overflow-wrap: normal !important; word-break: normal !important; overflow: auto !important; display: -webkit-box !important;"><span class="hljs-comment" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(128, 128, 128); word-wrap: inherit !important; word-break: inherit !important;">#!/usr/bin/expect&nbsp;-f

</span>

<span class="hljs-built_in" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(248, 35, 117); word-wrap: inherit !important; word-break: inherit !important;">set</span>&nbsp;timeout&nbsp;30
spawn&nbsp;ssh&nbsp;-p&nbsp;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;0]&nbsp;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;1]
expect&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;(yes/no)?&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{send&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;yes\n&quot;</span>;exp_continue}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;password:&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{send&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;[lindex&nbsp;<span class="hljs-variable" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(98, 151, 85); word-wrap: inherit !important; word-break: inherit !important;">$argv</span>&nbsp;2]\n&quot;</span>}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-string" style="font-size: inherit; line-height: inherit; margin: 0px; padding: 0px; color: rgb(238, 220, 112); word-wrap: inherit !important; word-break: inherit !important;">&quot;Last&nbsp;login&quot;</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{interact}
}
interact
</code></pre>
</section>
<p>记得用 <span style="color:#0000ff;">chmod +x iterm-login.sh</span>&nbsp;为其添加可执行权限。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;后续使用<br />
依次把每一台服务器的信息按上面的方法添加profile，完成之后，回到iTerm2主界面，按 Command+O&nbsp;快捷键调出&ldquo;<span style="color:#0000ff;">Profiles</span>&rdquo;对话框，可以在里面输入关键字快速搜索到服务器名，一回车就可以直接登录服务器了，不再需要手工输入用户名、密码，特别方便。</p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e9%85%8d%e7%bd%aeiterm2macos%e7%9a%84%e7%ab%99%e7%82%b9%e7%ae%a1%e7%90%86%e5%99%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] MAC配置(杂)</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e9%85%8d%e7%bd%ae%e6%9d%82/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e9%85%8d%e7%bd%ae%e6%9d%82/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Fri, 09 Nov 2018 15:54:23 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[MAC OS]]></category>
		<category><![CDATA[配置]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=10111</guid>

					<description><![CDATA[<p>
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;在MAC里安装Ubuntu虚拟机，使用共享文件夹<br />
宿主机：MAC OS<br />
虚拟机：Ubuntu 16.04<br />
首先在Virtualbox软件里设置好永久性的共享文件夹，但你会发现Ubuntu里根本看不到设置的共享文件夹，原因是你需要在虚拟机中安装Virtual Guest Additions软件，方法：<span style="color:#0000ff;">Devices</span>-&#62;<span style="color:#0000ff;">Insert Guest Additions CD Image...</span>，然后Ubuntu就会自动开始安装Virtual Guest Additions软件，安装好之后重启Ubuntu虚拟机，你会看到在Ubuntu文件管理器的左栏中多了一个共享文件夹的链接，不要以为此时就大功告成了，事实上现在还不能用，只要你一点击它，就会提示没有权限，原因是你需要在Ubuntu虚拟机中把你的当前用户添加到vboxsf用户组中：</p>
<blockquote>
<p>
		sudo adduser codelast vboxsf</p>
</blockquote>
<p>然后重启Ubuntu虚拟机，再点击共享文件夹试试看，问题解决。<br />
<span id="more-10111"></span><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;在MAC里读写NTFS格式的USB移动硬盘/U盘<br />
默认安装下你是无法在MAC OS里向NTFS格式的USB移动硬盘写入数据的(第一次使用MAC的话可能会觉得特别反人类)，其实你只需要安装一个叫&#8220;<span style="color:#0000ff;">Mounty for NTFS</span>&#8221;的软件就可以了。安装好之后启动这个软件，它会自动弹出提示，问你要不要把挂载的USB移动硬盘变成读写模式，确认之后就会发现，USB移动硬盘已经可以写入数据，done！</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;MAC下的五笔输入法<br />
作为一个五笔党，我第一次使用MAC OS的时候，上面的中文输入法实在把我恶心坏了，输入效率下降了90%都不止。直到我搜到了&#8220;<span style="color:#0000ff;">清歌输入法</span>&#8221;这个产品，终于又找回了类似于&#8220;极点五笔&#8221;的操作习惯，飞一般的感觉。如果你也是五笔用户，试一下，一定不会失望。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;MAC下的IntelliJ IDEA的Win按键失效问题<br />
理论上，在IntelliJ IDEA中，按住机械键盘上的<span style="color:#b22222;">Win键</span>+<span style="color:#b22222;">鼠标左键点击</span>JAVA项目里的一个变量名时，会自动跳到这个变量的定义处，但是某一天我把IntelliJ IDEA升级了一个版本之后，发现这样做没有任何反应了，我试了很多方法都不行，最后才发现，原来是IntelliJ的 <span style="color:#ff0000;">Preference</span>&#8594;<span style="color:#ff0000;">Keymap</span>里的配置，不知道怎么搞的变成了&#8220;<span style="color:#0000ff;">Default&#160;for XWin</span>&#8221;，当我选择&#8220;<span style="color:#0000ff;">Mac OS X 10.5+</span>&#8221;之后，就一切恢复了正常。<br />
所以，如果你也遇到了这个奇怪的问题，不妨这样试试。</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);">▶</span></span>&#160;MAC下的IntelliJ IDEA的从源代码跳到Project View的方法<br />
在Ubuntu下的IntelliJ IDEA里，默认按Alt+F5，会弹出一个菜单，选择&#8220;Project View&#8221;会立即定位到Project视图的对应文件上，在Mac下，如果Keymap是&#8220;Default for XWin&#8221;，等同效果的做法是：<span style="color:#0000ff;">Option</span>+<span style="color:#0000ff;">F1</span>，在弹出的菜单中选择&#8220;Project View&#8221;。如果不想用快捷键，可以通过菜单 <span style="color:#ff0000;">Navigate</span>&#8594;<span style="color:#ff0000;">Select In...</span>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e9%85%8d%e7%bd%ae%e6%9d%82/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;在MAC里安装Ubuntu虚拟机，使用共享文件夹<br />
宿主机：MAC OS<br />
虚拟机：Ubuntu 16.04<br />
首先在Virtualbox软件里设置好永久性的共享文件夹，但你会发现Ubuntu里根本看不到设置的共享文件夹，原因是你需要在虚拟机中安装Virtual Guest Additions软件，方法：<span style="color:#0000ff;">Devices</span>-&gt;<span style="color:#0000ff;">Insert Guest Additions CD Image...</span>，然后Ubuntu就会自动开始安装Virtual Guest Additions软件，安装好之后重启Ubuntu虚拟机，你会看到在Ubuntu文件管理器的左栏中多了一个共享文件夹的链接，不要以为此时就大功告成了，事实上现在还不能用，只要你一点击它，就会提示没有权限，原因是你需要在Ubuntu虚拟机中把你的当前用户添加到vboxsf用户组中：</p>
<blockquote>
<p>
		sudo adduser codelast vboxsf</p>
</blockquote>
<p>然后重启Ubuntu虚拟机，再点击共享文件夹试试看，问题解决。<br />
<span id="more-10111"></span><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;在MAC里读写NTFS格式的USB移动硬盘/U盘<br />
默认安装下你是无法在MAC OS里向NTFS格式的USB移动硬盘写入数据的(第一次使用MAC的话可能会觉得特别反人类)，其实你只需要安装一个叫&ldquo;<span style="color:#0000ff;">Mounty for NTFS</span>&rdquo;的软件就可以了。安装好之后启动这个软件，它会自动弹出提示，问你要不要把挂载的USB移动硬盘变成读写模式，确认之后就会发现，USB移动硬盘已经可以写入数据，done！</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MAC下的五笔输入法<br />
作为一个五笔党，我第一次使用MAC OS的时候，上面的中文输入法实在把我恶心坏了，输入效率下降了90%都不止。直到我搜到了&ldquo;<span style="color:#0000ff;">清歌输入法</span>&rdquo;这个产品，终于又找回了类似于&ldquo;极点五笔&rdquo;的操作习惯，飞一般的感觉。如果你也是五笔用户，试一下，一定不会失望。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MAC下的IntelliJ IDEA的Win按键失效问题<br />
理论上，在IntelliJ IDEA中，按住机械键盘上的<span style="color:#b22222;">Win键</span>+<span style="color:#b22222;">鼠标左键点击</span>JAVA项目里的一个变量名时，会自动跳到这个变量的定义处，但是某一天我把IntelliJ IDEA升级了一个版本之后，发现这样做没有任何反应了，我试了很多方法都不行，最后才发现，原来是IntelliJ的 <span style="color:#ff0000;">Preference</span>&rarr;<span style="color:#ff0000;">Keymap</span>里的配置，不知道怎么搞的变成了&ldquo;<span style="color:#0000ff;">Default&nbsp;for XWin</span>&rdquo;，当我选择&ldquo;<span style="color:#0000ff;">Mac OS X 10.5+</span>&rdquo;之后，就一切恢复了正常。<br />
所以，如果你也遇到了这个奇怪的问题，不妨这样试试。</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MAC下的IntelliJ IDEA的从源代码跳到Project View的方法<br />
在Ubuntu下的IntelliJ IDEA里，默认按Alt+F5，会弹出一个菜单，选择&ldquo;Project View&rdquo;会立即定位到Project视图的对应文件上，在Mac下，如果Keymap是&ldquo;Default for XWin&rdquo;，等同效果的做法是：<span style="color:#0000ff;">Option</span>+<span style="color:#0000ff;">F1</span>，在弹出的菜单中选择&ldquo;Project View&rdquo;。如果不想用快捷键，可以通过菜单 <span style="color:#ff0000;">Navigate</span>&rarr;<span style="color:#ff0000;">Select In...</span>来触发。</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MAC版GoLand IDE运行UT的时候提示&ldquo;<span style="color:#b22222;"><span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">ld: warning: text-based stub file ... out of sync</span></span>&rdquo;的问题<br />
具体错误如下：</p>
<blockquote>
<div>
		# crypto/x509</div>
<div>
		ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.</div>
<div>
		ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.</div>
</blockquote>
<p><a href="https://github.com/golang/go/issues/26073" rel="noopener noreferrer" style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;" target="_blank"><span style="background-color:#ffa07a;">这个</span></a><span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">网页里有一个解决方案：</span></p>
<blockquote>
<div>
		sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools.old</div>
<div>
		xcode-select --install</div>
<div>
		sudo rm -rf /Library/Developer/CommandLineTools.old</div>
</blockquote>
<p><span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">但我试了没用。同时，上面的网页里最后也提到，这个问题和Go无关，而是和Mac OS有关。</span><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;iTerm相关<br />
<span style="color:#0000ff;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span> 打字时发送相同的命令到所有tab<br />
外置标准键盘：<span style="color: rgb(0, 0, 205);">Win</span>+<span style="color: rgb(0, 0, 205);">Shift</span>+<span style="color: rgb(0, 0, 205);">I</span><br />
MacBook键盘：<span style="color: rgb(178, 34, 34);">Command</span>+<span style="color: rgb(178, 34, 34);">Shift</span>+<span style="color: rgb(178, 34, 34);">I</span><br />
<span style="color:#0000ff;"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;打字时发送相同的命令到单一tab下的所有子tab<br />
外置标准键盘：<span style="color: rgb(0, 0, 205);">Win</span>+<span style="color: rgb(0, 0, 205);">Alt</span>+<span style="color: rgb(0, 0, 205);">I</span><br />
MacBook键盘：<span style="color: rgb(178, 34, 34);">Command</span>+<span style="color: rgb(178, 34, 34);">Option</span>+<span style="color: rgb(178, 34, 34);">I</span>&nbsp;</p>
<p><span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MAC下的PyCharm，按名字查找一个class的快捷键(find&nbsp;a class by name)<br />
在Linux下此该快捷键是 Ctrl+N，在MAC OS下此该快捷键是 Command+O，弹出的对话框如下：<br />
<img decoding="async" alt="PyCharm find class by name" src="https://www.codelast.com/wp-content/uploads/ckfinder/images/pycharm_find_class_by_name.png" style="width: 1333px; height: 95px;" /><br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;Mac、Linux、Windows通用的免费图像编辑软件：<a href="https://krita.org/zh/" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">Krita</span></a></p>
<blockquote>
<div>
		Krita 是一款自由、免费、开源的专业绘画软件。它由懂得画画的程序员们开发，目标是打造一款人人都用得起的数字绘画工具。适用于：</div>
<div>
		● 概念美术设计</div>
<div>
		● 材质与电影布景</div>
<div>
		● 插画和漫画等</div>
</blockquote>
<div>
	强烈推荐，如果你想找PhotoShop的免费替代品，Krita是一个绝佳的选择，功能超级强大！</p>
<p>	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;配置iTerm2的&quot;站点管理器&quot;<br />
	看<a href="https://www.codelast.com/?p=11779" rel="noopener noreferrer" target="_blank"><span style="background-color:#ffa07a;">这里</span></a>。</p>
<p>	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;使用http server，把MAC上的文件共享给另一台电脑<br />
	在两台电脑处于同一局域网的情况下，毫无疑问，这是最简单的共享文件的方式，强烈推荐。<br />
	先启动：</p>
<blockquote>
<p>
			sudo apachectl start</p>
</blockquote>
<p>	再cd到共享文件所在的目录，然后使用Python启动一个http server：</p>
<blockquote>
<p>
			python -m http.server</p>
</blockquote>
<p>	注意这里是 Python 3.x&nbsp;版本。<br />
	这样，MAC上的http server就启动起来了，在另一台电脑上，使用浏览器就可以访问这个目录了：</p>
<blockquote>
<p>
			http://192.168.2.3:8000</p>
</blockquote>
<p>	其中，192.168.2.3是我MAC的局域网IP地址。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;MacOS的ssh命令报错：Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib&nbsp;解决办法：看<a href="https://www.codelast.com/?p=14021" rel="noopener" target="_blank">这里</a></p>
<p>	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;<a href="https://www.codelast.com/?p=14050" rel="noopener" target="_blank">MacOS上的Homebrew记录</a></p>
<p>	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;<a href="https://www.codelast.com/?p=14003">MacOS下的那些diff工具</a></p>
<p>	<span style="color: rgb(255, 0, 0);"><span style="background-color: rgb(0, 255, 0);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span></span>&nbsp;TODO:</p>
<p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
		<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e9%85%8d%e7%bd%ae%e6%9d%82/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] Mac终端使用Privoxy代理</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e7%bb%88%e7%ab%af%e4%bd%bf%e7%94%a8privoxy%e4%bb%a3%e7%90%86/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e7%bb%88%e7%ab%af%e4%bd%bf%e7%94%a8privoxy%e4%bb%a3%e7%90%86/#comments</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 27 Oct 2018 05:31:55 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Privoxy]]></category>
		<category><![CDATA[代理]]></category>
		<category><![CDATA[终端]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=10192</guid>

					<description><![CDATA[<p>
与<a href="https://www.codelast.com/?p=10185" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Ubuntu系统下的配置</span></a>过程比较相似，先安装Privoxy：</p>
<blockquote>
<p>
		brew install privoxy</p>
</blockquote>
<p>再修改其配置文件&#160;<span style="color:#0000ff;">/usr/local/etc/privoxy/config</span>，在文件末尾添加如下内容：<br />
<span id="more-10192"></span></p>
<pre style="color: rgb(0, 0, 32); background: rgb(246, 248, 255);">
forward-socks5 / <span style="color: rgb(0, 140, 0);">127</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">:</span><span style="color: rgb(0, 140, 0);">1080</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">.</span> <span style="color: rgb(89, 89, 121);"># SOCKS5代理地址</span>
listen-address <span style="color: rgb(0, 140, 0);">127</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">:</span><span style="color: rgb(0, 140, 0);">8080</span> <span style="color: rgb(89, 89, 121);"># HTTP代理地址</span>
forward <span style="color: rgb(0, 140, 0);">10</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(48, 128, 128);">*</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(48, 128, 128);">*</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span></pre>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e7%bb%88%e7%ab%af%e4%bd%bf%e7%94%a8privoxy%e4%bb%a3%e7%90%86/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>
与<a href="https://www.codelast.com/?p=10185" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Ubuntu系统下的配置</span></a>过程比较相似，先安装Privoxy：</p>
<blockquote>
<p>
		brew install privoxy</p>
</blockquote>
<p>再修改其配置文件&nbsp;<span style="color:#0000ff;">/usr/local/etc/privoxy/config</span>，在文件末尾添加如下内容：<br />
<span id="more-10192"></span></p>
<pre style="color: rgb(0, 0, 32); background: rgb(246, 248, 255);">
forward-socks5 / <span style="color: rgb(0, 140, 0);">127</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">:</span><span style="color: rgb(0, 140, 0);">1080</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">.</span> <span style="color: rgb(89, 89, 121);"># SOCKS5代理地址</span>
listen-address <span style="color: rgb(0, 140, 0);">127</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">:</span><span style="color: rgb(0, 140, 0);">8080</span> <span style="color: rgb(89, 89, 121);"># HTTP代理地址</span>
forward <span style="color: rgb(0, 140, 0);">10</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(48, 128, 128);">*</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(48, 128, 128);">*</span><span style="color: rgb(32, 0, 128); font-weight: bold;">.</span><span style="color: rgb(48, 128, 128);">*</span><span style="color: rgb(64, 1, 90);">/</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">.</span> <span style="color: rgb(89, 89, 121);"># 内网地址不走代理</span>
forward <span style="color: rgb(32, 0, 128); font-weight: bold;">.</span>abc<span style="color: rgb(32, 0, 128); font-weight: bold;">.</span>com<span style="color: rgb(64, 1, 90);">/</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">.</span> <span style="color: rgb(89, 89, 121);"># 指定域名不走代理</span></pre>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
然后以&nbsp;root 启动Privoxy（如果之前已经启动过，可以先 kill -9&nbsp;杀掉原来的进程再启动）：</p>
<pre style="color: rgb(0, 0, 32); background: rgb(246, 248, 255);">
sudo privoxy <span style="color: rgb(64, 1, 90);">/usr/local/etc/privoxy/config</span></pre>
<p>
<span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">再检查一下Privoxy是否启动成功了：</span></p>
<blockquote>
<div>
		<span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">codelast@codelast:~$ ps -ef | grep privoxy</span></div>
<div>
		<span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">&nbsp; 501&nbsp; 1391&nbsp; &nbsp; &nbsp;1&nbsp; &nbsp;0&nbsp; 1:08PM ??&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0:00.02 privoxy /usr/local/etc/privoxy/config</span></div>
<div>
		<span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">&nbsp; 501&nbsp; 1442&nbsp; 1363&nbsp; &nbsp;0&nbsp; 1:23PM ttys003&nbsp; &nbsp; 0:00.00 grep privoxy</span></div>
</blockquote>
<p>然后set两个环境变量：</p>
<pre style="color: rgb(0, 0, 32); background: rgb(246, 248, 255);">
<span style="color: rgb(119, 121, 187); font-weight: bold;">export</span> <span style="color: rgb(0, 125, 69);">http_proxy</span><span style="color: rgb(48, 128, 128);">=</span><span style="color: rgb(16, 96, 182);">&quot;127.0.0.1:8080&quot;</span>
<span style="color: rgb(119, 121, 187); font-weight: bold;">export</span> <span style="color: rgb(0, 125, 69);">https_proxy</span><span style="color: rgb(48, 128, 128);">=</span><span style="color: rgb(16, 96, 182);">&quot;127.0.0.1:8080&quot;</span></pre>
<p><span style="background-color: rgb(255, 255, 255); font-family: Verdana; font-size: 16px; white-space: pre;">现在终端就可以利用由sock5代理转成的http代理，来无障碍地访问各网站了。</span></p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-mac%e7%bb%88%e7%ab%af%e4%bd%bf%e7%94%a8privoxy%e4%bb%a3%e7%90%86/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 解决MAC OS的&quot;ssh-add: illegal option -- K&quot;错误</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e8%a7%a3%e5%86%b3mac-os%e7%9a%84ssh-add-illegal-option-k%e9%94%99%e8%af%af/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e8%a7%a3%e5%86%b3mac-os%e7%9a%84ssh-add-illegal-option-k%e9%94%99%e8%af%af/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Fri, 05 Oct 2018 15:04:17 +0000</pubDate>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[MAC OS]]></category>
		<category><![CDATA[ssh-add: illegal option -- K]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=10170</guid>

					<description><![CDATA[<p>
	今天在MAC OS上用 brew install openssh&#160;之后，再用iTerm2打开一个新窗口的时候，都会提示以下错误：</p>
<blockquote class="wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow">
	<p>
		ssh-add: illegal option -- K</p>
	<p>
		usage: ssh-add [options] [file &#8230;]</p>
</blockquote>
<p>
	在我的例子中，是由于安装openssh之后装上了一个新的ssh-add程序，和MAC OS原来自带的ssh-add有些不一样，MAC自带的ssh-add程序包含-K参数，而openssh带的那个ssh-add没有-K参数，因此不能识别，从而造成了错误。</p>
<span id="more-10170"></span><p>
	可以验证一下：</p>
<blockquote>
	<p>
		codelast@codelast:~$ which ssh-add<br />
		/usr/local/bin/ssh-add</p>
	<div>
		codelast@codelast:~$ ll /usr/local/bin/ssh-add</div>
	<div>
		lrwxr-xr-x 1 codelast admin 35 Oct 5 16:14 /usr/local/bin/ssh-add -&#62; ../Cellar/openssh/7.8p1/bin/ssh-add*</div>
</blockquote>
<p>
	可见确实是openssh装上的ssh-add。</p>
<p>
	然后再&#160;echo $PATH&#160;看一下，里面确实含有 <span style="color:#0000ff;">/usr/local/bin/</span>&#160;这个路径。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e8%a7%a3%e5%86%b3mac-os%e7%9a%84ssh-add-illegal-option-k%e9%94%99%e8%af%af/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[
<p>
	今天在MAC OS上用 brew install openssh&nbsp;之后，再用iTerm2打开一个新窗口的时候，都会提示以下错误：</p>
<blockquote class="wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow">
	<p>
		ssh-add: illegal option -- K</p>
	<p>
		usage: ssh-add [options] [file &hellip;]</p>
</blockquote>
<p>
	在我的例子中，是由于安装openssh之后装上了一个新的ssh-add程序，和MAC OS原来自带的ssh-add有些不一样，MAC自带的ssh-add程序包含-K参数，而openssh带的那个ssh-add没有-K参数，因此不能识别，从而造成了错误。</p>
<span id="more-10170"></span><p>
	可以验证一下：</p>
<blockquote>
	<p>
		codelast@codelast:~$ which ssh-add<br />
		/usr/local/bin/ssh-add</p>
	<div>
		codelast@codelast:~$ ll /usr/local/bin/ssh-add</div>
	<div>
		lrwxr-xr-x 1 codelast admin 35 Oct 5 16:14 /usr/local/bin/ssh-add -&gt; ../Cellar/openssh/7.8p1/bin/ssh-add*</div>
</blockquote>
<p>
	可见确实是openssh装上的ssh-add。</p>
<p>
	然后再&nbsp;echo $PATH&nbsp;看一下，里面确实含有 <span style="color:#0000ff;">/usr/local/bin/</span>&nbsp;这个路径。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	而MAC OS原版的ssh-add，是在&nbsp;<span style="color:#ff0000;">/usr/bin/ssh-add</span>&nbsp;这里。<br />
	所以现在问题就变成了，如何让默认的 ssh-add&nbsp;命令，使用MAC OS自带的那个 ssh-add？有一个特别简单的方法是，在 <span style="color:#b22222;">.bash_profile</span> 中定义一个别名：</p>
<blockquote>
	<p>
		alias ssh-add=&#39;/usr/bin/ssh-add&#39;</p>
</blockquote>
<p>
	然后问题就解决了。<br />
	<br />
	➤ <span style="background-color:#ffff00;">2022.01.15更新</span><br />
	升级到&nbsp;macOS Monterey&nbsp;系统之后，使用 ssh-add -K -A&nbsp;命令会打印出下面的WARNING信息：</p>
<blockquote>
	<p>
		The -K and -A flags are deprecated and have been replaced by the --apple-use-keychain and --apple-load-keychain flags, respectively.&nbsp; To suppress this warning, set the environment variable APPLE_SSH_ADD_BEHAVIOR as described in the ssh-add(1) manual page.</p>
</blockquote>
<p>
	说明 -K -A&nbsp;参数都过时了，此时你只需要用下面的命令替代就可以了：<br />
	<span style="color:#ff0000;">/usr/bin/ssh-add --apple-use-keychain --apple-load-keychain</span><br />
	<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e8%a7%a3%e5%86%b3mac-os%e7%9a%84ssh-add-illegal-option-k%e9%94%99%e8%af%af/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
