One of the key inputs to understand galactic chemical evolution is the gas and dust ejected from stars. However, it has been difficult to measure the actual gas and dust production from asymptotic giant branch (AGB) stars and supernovae (SNe) on a galaxy scale. Recent Spitzer Space Telescope observations have provided a unique opportunity to study almost the whole population of AGB stars in the Large Magellanic Cloud. We have analysed these data set to measure gas and dust ejected from AGB stars into the interstellar medium (ISM) of the LMC. We found that AGB stars can be important gas and dust sources in the LMC. We further detected amorphous dust grains in AGB stars in nearby dwarf spheroidal galaxies, which have very low metallicity. This shows that AGB stars can make dust grains even at very low metallicities, because carbon atoms are synthesised in these stars. We argue that AGB stars could have contributed to the dust formation in high-z galaxies as young as 0.2 Giga years old, regardless of the galaxy?s metallicity.