shellprof icon indicating copy to clipboard operation
shellprof copied to clipboard

Getting a permission denied error on my .bash_profile

Open YPCrumble opened this issue 5 years ago • 3 comments

Thanks for building this!

I'm getting the following error when trying to run ./shellprof ~/.bash_profile. I'm using the correct user - and although I've looked at the script I'm hesitant to play with sudo here.

PermissionError: [Errno 13] Permission denied: '/Users/me/.bash_profile'

YPCrumble avatar May 26 '20 17:05 YPCrumble

It's likely that ~/.bash_profile isn't executable. The way it's supposed to be run is by having bash read it in its own context.

You could try this:

./shellprof bash -c '. ~/.bash_profile'

Let me know if this helps!

walles avatar May 31 '20 17:05 walles

@walles thanks so much! You're right - that caused the permissions error. The only issue now is that it's profiling the entire script at once:

Timings for printed lines: 6.69s: <<<PROGRAM START>>>

YPCrumble avatar Jun 01 '20 10:06 YPCrumble

shellprof will tell you which printouts were on screen for how long.

So it will not profile lines of code, just lines of printout.

This should probably be emphasized more in the README.

What you could do as a workaround while profiling your startup script is adding echo lines to it, which you then remove after profiling is done.

walles avatar Jun 01 '20 10:06 walles