<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh" -->

---
title: Zsh: glob case-insensitively with the (#i) glob flag and...
description: Zsh globs are case-sensitive by default, even on macOS. The '(#i)' glob flag makes the rest of a pattern case-insensitive, so '*.(#i)jpg' matches 'CAT.JPG' and...
canonical: https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Zsh: glob case-insensitively with the (#i) glob flag and the no_case_glob option | daily.dev
og:description: Zsh globs are case-sensitive by default, even on macOS. The '(#i)' glob flag makes the rest of a pattern case-insensitive, so '*.(#i)jpg' matches 'CAT.JPG' and...
og:url: https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh
og:image: https://api.daily.dev/og/posts/TTfimbnfH.png
og:image:alt: Zsh: glob case-insensitively with the (#i) glob flag and the no_case_glob option
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Zsh: glob case-insensitively with the (#i) glob flag and the no_case_glob option

**[Adam Johnson](https://daily.dev/sources/adamj)** · 2 min read · 0 upvotes · 0 comments

## Summary

Zsh globs are case-sensitive by default, even on macOS. The '(#i)' glob flag makes the rest of a pattern case-insensitive, so '*.(#i)jpg' matches 'CAT.JPG' and 'dog.Jpg' as well as 'beach.jpg'. It requires the 'extended_glob' option, set with 'setopt extended_glob' in '~/.zshrc'. For global case-insensitivity, 'setopt no_case_glob' makes all globs ignore case, and 'setopt case_paths' keeps directory names case-sensitive.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://adamj.eu/tech/2026/10/30/zsh-case-insensitive-globbing>

## Questions this post answers

### How do I make a Zsh glob pattern match files regardless of case?

Use the '(#i)' glob flag before the pattern, such as '*.(#i)jpg', which makes the rest of the pattern case-insensitive so it matches 'beach.jpg', 'CAT.JPG', and 'dog.Jpg'. This flag requires the 'extended_glob' option to be enabled first, via 'setopt extended_glob' in the Zsh config file, otherwise Zsh treats '(#i)' as a literal pattern and reports no matches found.

_Configuring shell defaults like this is exactly the kind of tip developers track on daily.dev._

### Why are my Zsh globs case-sensitive even though my Mac's filesystem is case-insensitive?

Zsh globs are case-sensitive by default regardless of the underlying filesystem's case sensitivity, so '*.jpg' will not match 'CAT.JPG' on macOS even though the filesystem itself treats those names as equivalent. This is the same default behavior Bash uses. Enable 'setopt no_case_glob' to make all globs case-insensitive globally instead of relying on filesystem behavior.

_Shell quirks like this trip up a lot of devs; daily.dev surfaces fixes before they waste your afternoon._

### How do I make all Zsh globs case-insensitive without adding a flag to every pattern?

Add 'setopt no_case_glob' to your '~/.zshrc' file, which makes every glob pattern case-insensitive by default, so '*.jpg' matches 'CAT.JPG' without needing the '(#i)' flag. Note this also makes directory names in the glob path case-insensitive, so 'photos/*.jpg' would also match files inside 'Photos/'. Add 'setopt case_paths' alongside it if you want directory names to remain case-sensitive while filenames stay case-insensitive.

_Developers tuning their dotfiles often compare shell options like these on daily.dev before committing to a config._

## Similar posts on daily.dev

- [Zsh: uncover hidden files in globs with \(D\)](https://daily.dev/posts/zsh-uncover-hidden-files-in-globs-with-d--ltryb2zwq) · Adam Johnson · 0 upvotes · 0 comments
- [Zsh: tab complete glob qualifiers](https://daily.dev/posts/zsh-tab-complete-glob-qualifiers-trzdr8umc) · Adam Johnson · 1 upvotes · 0 comments
- [named globs with curl](https://daily.dev/posts/named-globs-with-curl-asgbvqvrj) · daniel.haxx.se · 4 upvotes · 0 comments
- [Glob patterns explained \(and why .gitignore behaves that way\)](https://daily.dev/posts/glob-patterns-explained-and-why-gitignore-behaves-that-way--dz2lmsm4g) · Flavio Copes · 1 upvotes · 0 comments
- [Parse Wildcard Arguments in Bash — Nick Janetakis](https://daily.dev/posts/parse-wildcard-arguments-in-bash-nick-janetakis-g9vroomhd) · Nick Janetakis · 2 upvotes · 1 comments

---

Tags: [#shell](https://daily.dev/tags/shell), [#bash](https://daily.dev/tags/bash)

[View this post on daily.dev](https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Zsh: glob case-insensitively with the (#i) glob flag and the no_case_glob option","url":"https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh"},"datePublished":"2026-10-31T22:46:21.048Z","dateModified":"2026-10-31T22:46:46.480Z","description":"Zsh globs are case-sensitive by default, even on macOS. The '(#i)' glob flag makes the rest of a pattern case-insensitive, so '*.(#i)jpg' matches 'CAT.JPG' and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c18f1dfbc6ca1d1ddc2180735e15d85a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c18f1dfbc6ca1d1ddc2180735e15d85a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Adam Johnson","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Adam Johnson","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/bf70f4401c284aa5b628d1966029342c","url":"https://daily.dev/sources/adamj"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"shell,bash","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Adam Johnson","item":"https://daily.dev/sources/adamj"},{"@type":"ListItem","position":3,"name":"Zsh: glob case-insensitively with the (#i) glob flag and the no_case_glob option"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/zsh-glob-case-insensitively-with-the-i-glob-flag-and-the-no-case-glob-option-ttfimbnfh#faq","mainEntity":[{"@type":"Question","name":"How do I make a Zsh glob pattern match files regardless of case?","acceptedAnswer":{"@type":"Answer","text":"Use the '(#i)' glob flag before the pattern, such as '*.(#i)jpg', which makes the rest of the pattern case-insensitive so it matches 'beach.jpg', 'CAT.JPG', and 'dog.Jpg'. This flag requires the 'extended_glob' option to be enabled first, via 'setopt extended_glob' in the Zsh config file, otherwise Zsh treats '(#i)' as a literal pattern and reports no matches found. Configuring shell defaults like this is exactly the kind of tip developers track on daily.dev."}},{"@type":"Question","name":"Why are my Zsh globs case-sensitive even though my Mac's filesystem is case-insensitive?","acceptedAnswer":{"@type":"Answer","text":"Zsh globs are case-sensitive by default regardless of the underlying filesystem's case sensitivity, so '*.jpg' will not match 'CAT.JPG' on macOS even though the filesystem itself treats those names as equivalent. This is the same default behavior Bash uses. Enable 'setopt no_case_glob' to make all globs case-insensitive globally instead of relying on filesystem behavior. Shell quirks like this trip up a lot of devs; daily.dev surfaces fixes before they waste your afternoon."}},{"@type":"Question","name":"How do I make all Zsh globs case-insensitive without adding a flag to every pattern?","acceptedAnswer":{"@type":"Answer","text":"Add 'setopt no_case_glob' to your '~/.zshrc' file, which makes every glob pattern case-insensitive by default, so '*.jpg' matches 'CAT.JPG' without needing the '(#i)' flag. Note this also makes directory names in the glob path case-insensitive, so 'photos/*.jpg' would also match files inside 'Photos/'. Add 'setopt case_paths' alongside it if you want directory names to remain case-sensitive while filenames stay case-insensitive. Developers tuning their dotfiles often compare shell options like these on daily.dev before committing to a config."}}]}
```

