Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash helpers don't work on MacOS #3289

Closed
danepowell opened this issue Jan 3, 2018 · 3 comments
Closed

Bash helpers don't work on MacOS #3289

danepowell opened this issue Jan 3, 2018 · 3 comments

Comments

@danepowell
Copy link
Contributor

danepowell commented Jan 3, 2018

I'm using Drush 8.1.15 on MacOS High Sierra. Well, technically I'm using Drush Launcher but I've run drush init from within a Composer project using Drush 8.1.15. I've also attempted this with 9.0.0-rc1 and the behavior is the same.

Drush init tries to install a bunch of helpers (Bash prompt and completion customizations), but these are broken on a Mac, for at least two reasons.

First, it appends file includes to .bashrc, which is fine for Linux environments, but doesn't work on Mac. Mac terminals are login shells by default, so they don't source .bashrc. These includes should instead be added to .bash_profile. A good example of the right switching logic to use here might be BLT: https://github.com/acquia/blt/blob/9.1.x/src/Robo/Commands/Blt/AliasCommand.php

Second, even if you add the correct includes to .bash_profile, the custom Git/Drush prompt doesn't work. The problem is that the __git_ps1 function doesn't exist out of the box with recent versions of Git on Mac. Not sure if that's a recent change, or different from Linux, or what. If you manually download and source git-prompt.sh (as described here) it works fine. Seems like we should document that if it's the recommended workflow.

@weitzman
Copy link
Member

weitzman commented Jan 3, 2018

I've kind of given up on picking the right file. I'd like to emit some generated code and tell people to append it themselves.

Sure, would be great to get some more detailed instructions for git+Mac.

@greg-1-anderson
Copy link
Member

.bashrc is probably my fault. I started on Linux; when I switched to Mac, I just source my .bashrc from my .bash_profile. As for PS1, I currently have some other prompt installed, rather than Drush's. PRs to fix the code rot would be great.

@danepowell
Copy link
Contributor Author

Hah, no worries... I agree that it's confusing, and might be best to just let people configure their profiles themselves.

I'll try to figure out what's going on with the Git function.

danepowell added a commit to danepowell/drush that referenced this issue Jan 3, 2018
danepowell added a commit to danepowell/drush that referenced this issue Jan 3, 2018
greg-1-anderson pushed a commit that referenced this issue Jan 4, 2018
* Fixes #3289: Bash helpers don't work on Mac.

* Code style fix.

* Fall back to bashrc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants