Need help with using the Terminal to unpack a .tar.gz compressed file.

tar -xzf file.tar.gz not working in Sonoma.

I have a large compressed file that I want to unpack.

But the Terminal says zsh is the default interactive shell.

To update my account to use zsh, run cash -s /bin/ zsh


I am clueless


MacBook Pro 16″, macOS 14.6

Posted on Feb 1, 2026 10:27 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 1, 2026 1:39 PM

Simply double-clicking on a foo.tar.gz compressed item in the Finder will unpack it. I recommend creating a new folder, and placing the *.tar.gz file in it first. That way, if the creator did not include its original folder and just files, you can contain them in the new folder and not spray all over the Downloads folder.


Apple has been using the Bash shell for decades and has switched to the Zsh shell since it has an MIT license. Apple has included a notification in the Terminal about changing to the Zsh shell and associated syntax to do that, but it is optional and you can continue to use the old Bash shell.


Otherwise in the Terminal, I would do this first to see the structure of the tar contents without extraction. The following works in Bash or Zsh shells.

tar -tf foo.tar.gz | more


If you do not want the enclosing folder, should it be shown from the above, you can remove it and just unzip the subsequent content hierarchy into the current folder with this adjustment:

tar -xf foo.tar.gz --strip-components 1


The tar -f flag detects what type of compression was used and invokes the appropriate uncompress tool before extraction occurs.

4 replies
Question marked as Top-ranking reply

Feb 1, 2026 1:39 PM in response to NankerJct

Simply double-clicking on a foo.tar.gz compressed item in the Finder will unpack it. I recommend creating a new folder, and placing the *.tar.gz file in it first. That way, if the creator did not include its original folder and just files, you can contain them in the new folder and not spray all over the Downloads folder.


Apple has been using the Bash shell for decades and has switched to the Zsh shell since it has an MIT license. Apple has included a notification in the Terminal about changing to the Zsh shell and associated syntax to do that, but it is optional and you can continue to use the old Bash shell.


Otherwise in the Terminal, I would do this first to see the structure of the tar contents without extraction. The following works in Bash or Zsh shells.

tar -tf foo.tar.gz | more


If you do not want the enclosing folder, should it be shown from the above, you can remove it and just unzip the subsequent content hierarchy into the current folder with this adjustment:

tar -xf foo.tar.gz --strip-components 1


The tar -f flag detects what type of compression was used and invokes the appropriate uncompress tool before extraction occurs.

Feb 1, 2026 1:42 PM in response to NankerJct

NankerJct wrote:

tar -xzf file.tar.gz not working in Sonoma.
I have a large compressed file that I want to unpack.

What error message is given when it fails?


Try omitting the "z" part to see if that makes any difference:

tar  -xf  file.tar.gz


You are providing the proper path to the file?


FYI, macOS Finder can open these files just by double-clicking on them. With the ".tar.gz" extensions, it is possible that the Finder will only uncompress the archive and leave you with a ".tar" file which you should still be able to open by double-clicking on it as well to get to the actual archive contents.


But the Terminal says zsh is the default interactive shell.
To update my account to use zsh, run cash -s /bin/ zsh

You don't have to do anything here if you don't normally use the Terminal. The only reason to make the change is to use Zsh and/or to have this message gone when you launch the Terminal. It won't make any difference for a casual user.


FYI, you need to be very careful with using the command line since there are no safety nets. You mistyped the command in your post......you wrote "cash".....that should be "chsh". If "cash" had been an actual valid utility, then who knows what may have happened since there are no safety nets. @D.I. Johnson has you covered with the full correct command to use.

Feb 2, 2026 5:11 AM in response to NankerJct

NankerJct wrote:

But the Terminal says zsh is the default interactive shell.
To update my account to use zsh, run cash -s /bin/ zsh


This is Apple's way of "encouraging" you to switch to the zsh shell.


If you were using an older version of Mac OS X / macOS where bash was your default, and upgraded macOS "in place", they won't change your choice of shell out from under you, but they will nag you to try to get you to make this change.


The version of bash that Apple ships is ancient. In Sequoia:


% bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)
Copyright (C) 2007 Free Software Foundation, Inc.


The latest version appears to be 5.3.something, but using it would require Apple to abide by the terms of version 3 of the GNU General Public License, and they apparently are unwilling to accept the changes in GPL version 3. Thus the switch to zsh, and the continued distribution of an old version of bash that is subject to an earlier version of the license.

Need help with using the Terminal to unpack a .tar.gz compressed file.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.