Search Unity

  1. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Using Rider with zsh doesn't work when Unity opens Rider

Discussion in 'Linux Editor' started by MostHated, Aug 10, 2019.

  1. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    926
    I am running into an issue where when Unity opens Rider which has terminal set within IDE to /usr/bin/zsh), it won't use zsh for some reason, and of course all of my applications and env variables are setup using scripts and such via zsh.

    If I open Rider on it's own zsh is picked up and works just fine. It has all my env variables, installed applications and proper $PATH, but with Unity I just keep getting:

    Code (CSharp):
    1. Cannot open Local Terminal
    2. Failed to start [/usr/bin/zsh, -i] in /home/mosthated/path/to/project
    3.  
    4.  
    For Rider to work in general with zsh I had to go into /home/mosthated/.local/share/JetBrains/Toolbox/apps/Rider/ch-0/192.5895.1069/plugins/terminal/.zshrc and change the last function to the following for it to work:

    Code (CSharp):
    1. function override_jb_variables {
    2.   for VARIABLE in $(env)
    3.   do
    4.     NAME=${VARIABLE%%=*}
    5.     if [[ $NAME = '_INTELLIJ_FORCE_SET_'* ]]
    6.     then
    7.       NEW_NAME=${NAME:20}
    8.       if [ -n "$NEW_NAME" ] && [ "$NEW_NAME" != "PATH" ]
    9.       then
    10.         VALUE=${VARIABLE#*=}
    11.         export "$NEW_NAME"="$VALUE"
    12.       fi
    13.     fi
    14.   done
    15. }
    Does Unity have it's own settings/config somewhere that is overwriting what may be in the above path that I need to change somewhere for it to work? Unity/Rider is even thinking Git isn't installed when it opens, so it is going to end up being quite inconvenient.

    Thanks,
    -MH
     
  2. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    926
    Looks like I have it worked out. I had to initially start Unity hub as sudo and then it finally ended up working.

    **EDIT**

    For some reason, only after logging out and back in starting Unity Hub as sudo began opening Unity itself as well as Rider as as root, which gave a warning message, then also tried to load a new Rider profile for the root user.

    So it looks like the actual solution is simply starting the Unity Hub application from the terminal.
    I created a zsh alias for this :

    Code (CSharp):
    1. alias unity='/home/mosthated/_dev/applications/UnityHubSetup.AppImage'
     
    Last edited: Aug 11, 2019
unityunity