Warp icon indicating copy to clipboard operation
Warp copied to clipboard

how to include `~/.bashrc` when launching warp

Open vchong opened this issue 1 year ago • 13 comments

Dupe Check

Describe the solution you'd like?

i'd like to have all the customization (aliases, functions, etc) in ~/.bashrc available when warp is launched

Is your feature request related to a problem? Please describe.

No response

Additional context

No response

How important is this feature to you?

5 (Can't work without it!)

Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1

None

vchong avatar Dec 05 '24 18:12 vchong

Hey @vchong thanks for submitting. Warp supports loading the rc files on launch. Just make sure you have bash as your default prompt in Settings > Features > Startup shell for new sessions. https://docs.warp.dev/getting-started/using-warp-with-shells#changing-what-shell-warp-uses

Also, if you have a custom shell prompt setup in your rc files, go to Settings > Appearance > Prompt and select your Shell prompt (PS1). https://docs.warp.dev/appearance/prompt#how-to-access-it

Once you're done with those settings just open a new session and the changes should apply.

Closing as this feature exists, but please let me know if any issues with it.

dannyneira avatar Dec 05 '24 20:12 dannyneira

@dannyneira Settings > Features > Startup shell was on Default, which was bash anyway. Setting it to Bash (/usr/bin/bash) doesn't help, as in i still don't see my aliases etc from .bashrc.

vchong avatar Dec 06 '24 09:12 vchong

Hm this may be due to multiple versions of bash on your system, run which -a bash and put the top result into the Startup shell for new sessions > Custom setting. Also if you can share a copy of your bashrc we can try and reproduce the issue. Make sure to not include any important info like secrets or API keys.

dannyneira avatar Dec 06 '24 15:12 dannyneira

which -a bash returns /usr/bin/bash which is the same as setting it to Bash (/usr/bin/bash) anyway. Tried manually setting it anyway with Custom but still no aliases. :(

vchong avatar Dec 06 '24 18:12 vchong

Yeah sorry about that, i suspect you may have something else unsupported in your bashrc file causing the issue. Can you please share a copy of your .bashrc so that we can try and reproduce the issue? Make sure to not include any important info like secrets or API keys.

We have a list of known incompatible tools here: https://docs.warp.dev/help/known-issues#list-of-incompatible-tools

dannyneira avatar Dec 06 '24 18:12 dannyneira

i tested with a very simple .bashrc file and it still doesn't work

from a terminal:

$ echo $SHELL
/bin/bash

$ alias
alias grep='grep --color=auto'
alias ll='ls -lah'
alias ls='ls --color=auto'

$ cat ~/.bashrc
alias ls='ls --color=auto'
alias ll='ls -lah'
alias grep='grep --color=auto'
PS1='$ '

$ which -a bash
/usr/bin/bash
/bin/bash

Screenshot from 2024-12-07 23-36-34 Screenshot from 2024-12-07 23-35-46 Screenshot from 2024-12-07 23-37-14

vchong avatar Dec 07 '24 14:12 vchong

Thanks for the info @vchong I'm having trouble reproducing this on the latest version of bash on Mac.

I recommend you install the latest version of bash (i.e. sudo apt upgrade ; sudo apt install bash on Ubuntu for example), then make sure that version is being used in your settings. If this fails please provide the logs for this issue.

CleanShot 2024-12-09 at 12 45 39

dannyneira avatar Dec 09 '24 19:12 dannyneira

Already at the latest version. Have you tried on Ubuntu?

$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ sudo apt install bash
[sudo] password for [redacted]: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
bash is already the newest version (5.1-6ubuntu1.1).
bash set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.

vchong avatar Dec 10 '24 00:12 vchong

@vchong i see, I tested both on Ubuntu 24 with bash 5.2 and Ubuntu 22 with bash 5.1 and both didn't have the same issue as you. I suspect there may be something in your ~/.bash_profile, which is loaded before the ~/.bashrc, that may be causing this issue. If not, then it could be the settings in Warp. Also, in the past, there were issues with the --color=auto option, but as far as I know these issues have been fixed.

First, check your ~/.bash_profile for anything in the list of incompatible tools. https://docs.warp.dev/help/known-issues#list-of-incompatible-tools If any, you can comment it out for Warp with the following snippet:

if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
    # Unsupported plugin/prompt code here, i.e.
fi

If this doesn't help, I recommend you try a full uninstall, including any settings, database, and files, then reinstall and see if the issue persists. https://docs.warp.dev/help/uninstalling-warp#uninstalling-warp

dannyneira avatar Dec 10 '24 01:12 dannyneira

@vchong any luck searching thru your bash_profile file?

dannyneira avatar Dec 18 '24 00:12 dannyneira

If you are still encountering this, add source ~/.bash_profile to ~/.bashrc.

vanarok avatar Feb 06 '25 09:02 vanarok

Adding source ~/.bashrc to ~/.bash_profile worked.

sonalsinghai avatar May 07 '25 20:05 sonalsinghai

My system (nixOS) didn't hat a ~/.bash_profile yet, only ~/.bashrc and ~/.bash_aliases.

Creating a bash_profile helped. I recommend adding an if to be fail-safe:

# ~/.bash_profile
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

However, I think warp should handle loading of bashrc as bash_profile is for login shells and often missing depending on the system (in my understanding).

turbotimon avatar Jun 11 '25 08:06 turbotimon