<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>~iany/ Shell</title><link>https://blog.iany.me/tags/shell/</link><description>Recent content in Shell «~iany/»</description><language>en-US</language><managingEditor>me@iany.me (Ian Yang)</managingEditor><webMaster>me@iany.me (Ian Yang)</webMaster><copyright>CC-BY-SA 4.0</copyright><lastBuildDate>Wed, 26 Nov 2025 11:31:37 +0800</lastBuildDate><atom:link href="https://blog.iany.me/tags/shell/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Activate mise for Cursor When It Runs Shell Commands</title><link>https://blog.iany.me/2025/11/how-to-activate-mise-for-cursor-when-it-runs-shell-commands/</link><pubDate>Wed, 26 Nov 2025 11:31:37 +0800</pubDate><author>me@iany.me (Ian Yang)</author><guid>https://blog.iany.me/2025/11/how-to-activate-mise-for-cursor-when-it-runs-shell-commands/</guid><description>&lt;p&gt;When using &lt;a href="https://mise.jdx.dev/"&gt;mise&lt;/a&gt; with Cursor, you may notice that the mise environment is not activated when Cursor executes shell commands. This occurs because Cursor launches a non-login shell, which initializes differently than an interactive login shell and therefore does not automatically source your usual mise setup.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The Problem&lt;/h2&gt;
&lt;p&gt;Cursor runs commands in a non-login shell, which means:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;zsh&lt;/strong&gt;: Only &lt;code&gt;.zshenv&lt;/code&gt; is loaded (not &lt;code&gt;.zshrc&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;bash&lt;/strong&gt;: Only &lt;code&gt;.bash_profile&lt;/code&gt; is loaded (not &lt;code&gt;.bashrc&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve configured mise activation in &lt;code&gt;.zshrc&lt;/code&gt; or &lt;code&gt;.zprofile&lt;/code&gt;, it won&amp;rsquo;t be available when Cursor executes commands.&lt;/p&gt;
&lt;h2 id="the-solution"&gt;The Solution&lt;/h2&gt;
&lt;p&gt;The solution is to activate mise in &lt;code&gt;.zshenv&lt;/code&gt; (for zsh) or &lt;code&gt;.bash_profile&lt;/code&gt; (for bash) when the file is loaded by Cursor. You can detect Cursor by checking for the &lt;code&gt;CURSOR_AGENT&lt;/code&gt; environment variable.&lt;/p&gt;
&lt;p&gt;Add this to your &lt;code&gt;~/.zshenv&lt;/code&gt; or &lt;code&gt;~/.bash_profile&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-shell"&gt;# Activate mise when running in Cursor
if [[ -n &amp;quot;$CURSOR_AGENT&amp;quot; ]]; then
eval &amp;quot;$(mise activate)&amp;quot;
fi
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="why-this-works"&gt;Why This Works&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.zshenv&lt;/code&gt; (or &lt;code&gt;.bash_profile&lt;/code&gt;) is always sourced for non-login shells&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;CURSOR_AGENT&lt;/code&gt; environment variable is set when Cursor runs commands&lt;/li&gt;
&lt;li&gt;By conditionally activating mise only when &lt;code&gt;CURSOR_AGENT&lt;/code&gt; is present, you avoid potential conflicts or slowdowns in other non-login shell contexts&lt;/li&gt;
&lt;li&gt;This ensures mise and all its configured tools are available when Cursor executes terminal commands&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After adding this configuration, rerun Cursor chats, and mise should be available in all Cursor shell commands.&lt;/p&gt;</description><category domain="https://blog.iany.me/post/">Posts</category><category domain="https://blog.iany.me/tags/mise/">Mise</category><category domain="https://blog.iany.me/tags/cursor/">Cursor</category><category domain="https://blog.iany.me/tags/shell/">Shell</category><category domain="https://blog.iany.me/tags/zsh/">Zsh</category><category domain="https://blog.iany.me/tags/vibe-coding/">Vibe Coding</category></item></channel></rss>